Skip to content

Commit

Permalink
test(character): add test for character with shield
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidWeb committed Nov 7, 2021
1 parent 463185d commit f3bda9e
Show file tree
Hide file tree
Showing 3 changed files with 2,735 additions and 6 deletions.
6 changes: 3 additions & 3 deletions docs/api/classes/client_LodestoneClient.default.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[client/LodestoneClient](../modules/client_LodestoneClient.md).default

Client for interfacing with the Final Fantasy XIV Lodestone
Client for interfacing with the Final Fantasy XIV Lodestone.

## Table of contents

Expand All @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone

#### Defined in

[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L53)
[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L53)

## Properties

Expand All @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your

#### Defined in

[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L49)
[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L49)
35 changes: 32 additions & 3 deletions src/entity/__tests__/Character.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ import GearCategory from '../GearCategory'

describe('Character', () => {
describe('when loading character information from HTML', () => {
// Character with Free Company, Grand Company, Full Gear, No Shield
const expectedCharacterOne: Character = {
id: 11886902,
name: "P'tajha Rihll",
server: 'Cerberus',
homeWorld: 'Cerberus',
dataCenter: 'Chaos',
race: 'Elezen',
clan: 'Wildwood',
Expand Down Expand Up @@ -247,10 +248,11 @@ describe('Character', () => {
},
}

// Character with no Grand Company
const expectedCharacterTwo: Character = {
id: 38531003,
name: 'Aurora Nyx',
server: 'Omega',
homeWorld: 'Omega',
dataCenter: 'Chaos',
race: 'Elezen',
clan: 'Wildwood',
Expand All @@ -262,13 +264,40 @@ describe('Character', () => {
grandCompany: undefined,
}

// Character with a shield
const expectedCharacterThree: Character = {
id: 11886902,
name: 'Shamir Kotomine',
activeClass: Class.Gladiator,
cityState: 'Limsa Lominsa',
clan: 'Dunesfolk',
homeWorld: 'Cerberus',
title: 'Outlander',
dataCenter: 'Chaos',
freeCompany: 'Cerberus (Chaos)',
gear: {
shield: {
category: GearCategory.Shield,
name: 'Augmented Scaevan Magitek Shield',
id: '92995e4130e',
iLvl: 400,
},
},
gender: 'Female',
grandCompany: 'Maelstrom',
grandCompanyRank: 'Storm Corporal',
guardian: 'Halone, the Fury',
nameDay: '8th Sun of the 1st Astral Moon',
race: 'Lalafell',
}

// TODO: Test character with shield
// TODO: test character with no grand company
// TODO: test character with no free company

describe.each([
[11886902, "P'tajha Rihll", expectedCharacterOne],
[38531003, 'Aurora Nyxx', expectedCharacterTwo],
[27218992, 'Shamir Kotmine', expectedCharacterThree],
])('for character %s - %s', (charId, name, expected) => {
let resultantCharacter: Character
const nonObjectAttributes = Object.entries(expected).filter((pair) => typeof pair[1] !== 'object')
Expand Down
Loading

0 comments on commit f3bda9e

Please sign in to comment.