Skip to content

Commit

Permalink
Update tests after tweaking protected resource APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Aug 11, 2024
1 parent 763c7e9 commit d602792
Show file tree
Hide file tree
Showing 18 changed files with 32 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@ describe('characterAchievementsSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterAchievementsSummary(realmSlug, characterName, token);
const result = characterAchievementsSummary(realmSlug, characterName);

expect(result.namespace).toBe('profile');
expect(result.path).toBe('/profile/wow/character/realm/character/achievements');
expect(result.token).toBe(token);
});
});

describe('characterAchievementStatistics', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterAchievementStatistics(realmSlug, characterName, token);
const result = characterAchievementStatistics(realmSlug, characterName);

expect(result.namespace).toBe('profile');
expect(result.path).toBe('/profile/wow/character/realm/character/achievements/statistics');
expect(result.token).toBe(token);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterAppearanceSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'test-realm';
const characterName = 'test-character';
const token = 'test-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/test-realm/test-character/appearance',
token: 'test-token',
};

const result = characterAppearanceSummary(realmSlug, characterName, token);
const result = characterAppearanceSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ import {
describe('Character Collections', () => {
const realmSlug = 'realm-slug';
const characterName = 'character-name';
const token = 'token';

it('should generate the correct protected resource for characterCollectionsIndex', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections',
token: 'token',
};

const resource = characterCollectionsIndex(realmSlug, characterName, token);
const resource = characterCollectionsIndex(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand All @@ -29,10 +27,9 @@ describe('Character Collections', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections/heirlooms',
token: 'token',
};

const resource = characterHeirloomsCollectionSummary(realmSlug, characterName, token);
const resource = characterHeirloomsCollectionSummary(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand All @@ -41,10 +38,9 @@ describe('Character Collections', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections/mounts',
token: 'token',
};

const resource = characterMountsCollectionSummary(realmSlug, characterName, token);
const resource = characterMountsCollectionSummary(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand All @@ -53,10 +49,9 @@ describe('Character Collections', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections/pets',
token: 'token',
};

const resource = characterPetsCollectionSummary(realmSlug, characterName, token);
const resource = characterPetsCollectionSummary(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand All @@ -65,10 +60,9 @@ describe('Character Collections', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections/toys',
token: 'token',
};

const resource = characterToysCollectionSummary(realmSlug, characterName, token);
const resource = characterToysCollectionSummary(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand All @@ -77,10 +71,9 @@ describe('Character Collections', () => {
const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/realm-slug/character-name/collections/transmogs',
token: 'token',
};

const resource = characterTransmogCollectionSummary(realmSlug, characterName, token);
const resource = characterTransmogCollectionSummary(realmSlug, characterName);

expect(resource).toEqual(expectedResource);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,35 @@ describe('Character Encounters', () => {
it('should return the correct ProtectedResource object for character encounters', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterEncountersSummary(realmSlug, characterName, token);
const result = characterEncountersSummary(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: 'profile/wow/character/realm/character/encounters',
token,
});
});
it('should return the correct ProtectedResource object for character dungeons', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterDungeons(realmSlug, characterName, token);
const result = characterDungeons(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: 'profile/wow/character/realm/character/encounters/dungeons',
token,
});
});

it('should return the correct ProtectedResource object for character raids', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterRaids(realmSlug, characterName, token);
const result = characterRaids(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: 'profile/wow/character/realm/character/encounters/raids',
token,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterEquipmentSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'test-realm';
const characterName = 'test-character';
const token = 'test-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/test-realm/test-character/equipment',
token: 'test-token',
};

const result = characterEquipmentSummary(realmSlug, characterName, token);
const result = characterEquipmentSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterHunterPetsSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'testRealm';
const characterName = 'testCharacter';
const token = 'testToken';

const expectedResource = {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/hunter-pets`,
token,
};

const result = characterHunterPetsSummary(realmSlug, characterName, token);
const result = characterHunterPetsSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
4 changes: 1 addition & 3 deletions packages/wow/src/character-media/character-media.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterMediaSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'test-realm';
const characterName = 'test-character';
const token = 'test-token';

const expectedResource = {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/character-media`,
token,
};

const result = characterMediaSummary(realmSlug, characterName, token);
const result = characterMediaSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,25 @@ describe('Character Mythic Keystone Profile', () => {
it('should return the correct ProtectedResource object for characterMythicKeystoneProfileIndex', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterMythicKeystoneProfileIndex(realmSlug, characterName, token);
const result = characterMythicKeystoneProfileIndex(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile`,
token,
});
});

it('should return the correct ProtectedResource object for characterMythicKeystoneSeasonDetails', () => {
const realmSlug = 'realm';
const characterName = 'character';
const seasonId = 123;
const token = 'token';

const result = characterMythicKeystoneSeasonDetails(realmSlug, characterName, seasonId, token);
const result = characterMythicKeystoneSeasonDetails(realmSlug, characterName, seasonId);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile/season/${seasonId}`,
token,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterProfessionsSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'test-realm';
const characterName = 'test-character';
const token = 'test-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/test-realm/test-character/professions',
token: 'test-token',
};

const result = characterProfessionsSummary(realmSlug, characterName, token);
const result = characterProfessionsSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
8 changes: 2 additions & 6 deletions packages/wow/src/character-profile/character-profile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ describe('characterProfileSummary', () => {
it('should return the correct protected resource object', () => {
const realmSlug = 'example-realm';
const characterName = 'example-character';
const token = 'example-token';

const result = characterProfileSummary(realmSlug, characterName, token);
const result = characterProfileSummary(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}`,
token,
});
});
});
Expand All @@ -21,14 +19,12 @@ describe('characterProfileStatus', () => {
it('should return the correct protected resource object', () => {
const realmSlug = 'example-realm';
const characterName = 'example-character';
const token = 'example-token';

const result = characterProfileStatus(realmSlug, characterName, token);
const result = characterProfileStatus(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/status`,
token,
});
});
});
4 changes: 1 addition & 3 deletions packages/wow/src/character-pvp/character-pvp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterPvpSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'example-realm';
const characterName = 'example-character';
const token = 'example-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/example-realm/example-character/pvp-summary',
token: 'example-token',
};

const result = characterPvpSummary(realmSlug, characterName, token);
const result = characterPvpSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
8 changes: 2 additions & 6 deletions packages/wow/src/character-quests/character-quests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ describe('characterQuests', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterQuests(realmSlug, characterName, token);
const result = characterQuests(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/quests`,
token,
});
});
});
Expand All @@ -21,14 +19,12 @@ describe('characterCompletedQuests', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterCompletedQuests(realmSlug, characterName, token);
const result = characterCompletedQuests(realmSlug, characterName);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/quests/completed`,
token,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterReputationsSummary', () => {
it('should return the correct ProtectedResource object', () => {
const realmSlug = 'test-realm';
const characterName = 'test-character';
const token = 'test-token';

const expectedResource = {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/reputations`,
token,
};

const result = characterReputationsSummary(realmSlug, characterName, token);
const result = characterReputationsSummary(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ describe('characterSoulbinds', () => {
it('returns the correct ProtectedResource object', () => {
const realmSlug = 'example-realm';
const characterName = 'example-character';
const token = 'example-token';

const expectedResource = {
namespace: 'profile',
path: '/profile/wow/character/example-realm/example-character/soulbinds',
token: 'example-token',
};

const result = characterSoulbinds(realmSlug, characterName, token);
const result = characterSoulbinds(realmSlug, characterName);

expect(result).toEqual(expectedResource);
});
Expand Down
Loading

0 comments on commit d602792

Please sign in to comment.