Skip to content

Commit

Permalink
fix: add type prop to DatedUserAchievement model (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
minhaferzz authored Feb 27, 2024
1 parent 04ffe2b commit f45d79c
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 14 deletions.
19 changes: 13 additions & 6 deletions src/user/getAchievementsEarnedBetween.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { setupServer } from "msw/node";
import { apiBaseUrl } from "../utils/internal";
import { buildAuthorization } from "../utils/public";
import { getAchievementsEarnedBetween } from "./getAchievementsEarnedBetween";
import type { DatedUserAchievementsResponse } from "./models";
import type {
DatedUserAchievement,
DatedUserAchievementsResponse
} from "./models";

const server = setupServer();

Expand Down Expand Up @@ -42,7 +45,8 @@ describe("Function: getAchievementsEarnedBetween", () => {
ConsoleName: "PlayStation Portable",
CumulScore: 40,
BadgeURL: "/Badge/193797.png",
GameURL: "/game/3571"
GameURL: "/game/3571",
Type: "progression"
}
];

Expand All @@ -59,8 +63,7 @@ describe("Function: getAchievementsEarnedBetween", () => {
toDate: new Date("2022-10-13")
});

// ASSERT
expect(response).toEqual([
const expectedResponse: DatedUserAchievement[] = [
{
date: "2022-10-12 07:36:31",
hardcoreMode: true,
Expand All @@ -76,8 +79,12 @@ describe("Function: getAchievementsEarnedBetween", () => {
consoleName: "PlayStation Portable",
cumulScore: 40,
badgeUrl: "/Badge/193797.png",
gameUrl: "/game/3571"
gameUrl: "/game/3571",
type: "progression"
}
]);
];

// ASSERT
expect(response).toEqual(expectedResponse);
});
});
3 changes: 2 additions & 1 deletion src/user/getAchievementsEarnedBetween.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ import type {
* consoleName: 'PlayStation Portable',
* cumulScore: 120,
* badgeUrl: '/Badge/193756.png',
* gameUrl: '/game/3571'
* gameUrl: '/game/3571',
* type: 'progression'
* }
* ]
* ```
Expand Down
19 changes: 13 additions & 6 deletions src/user/getAchievementsEarnedOnDay.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { setupServer } from "msw/node";
import { apiBaseUrl } from "../utils/internal";
import { buildAuthorization } from "../utils/public";
import { getAchievementsEarnedOnDay } from "./getAchievementsEarnedOnDay";
import type { DatedUserAchievementsResponse } from "./models";
import type {
DatedUserAchievement,
DatedUserAchievementsResponse
} from "./models";

const server = setupServer();

Expand Down Expand Up @@ -42,7 +45,8 @@ describe("Function: getAchievementsEarnedOnDay", () => {
ConsoleName: "PlayStation Portable",
CumulScore: 40,
BadgeURL: "/Badge/193797.png",
GameURL: "/game/3571"
GameURL: "/game/3571",
Type: null
}
];

Expand All @@ -58,8 +62,7 @@ describe("Function: getAchievementsEarnedOnDay", () => {
onDate: new Date("2022-10-12")
});

// ASSERT
expect(response).toEqual([
const expectedResponse: DatedUserAchievement[] = [
{
date: "2022-10-12 07:36:31",
hardcoreMode: true,
Expand All @@ -75,8 +78,12 @@ describe("Function: getAchievementsEarnedOnDay", () => {
consoleName: "PlayStation Portable",
cumulScore: 40,
badgeUrl: "/Badge/193797.png",
gameUrl: "/game/3571"
gameUrl: "/game/3571",
type: null
}
]);
];

// ASSERT
expect(response).toEqual(expectedResponse);
});
});
3 changes: 2 additions & 1 deletion src/user/getAchievementsEarnedOnDay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ import type {
* consoleName: 'PlayStation Portable',
* cumulScore: 120,
* badgeUrl: '/Badge/193756.png',
* gameUrl: '/game/3571'
* gameUrl: '/game/3571',
* type: 'progression'
* }
* ]
* ```
Expand Down
1 change: 1 addition & 0 deletions src/user/models/dated-user-achievement.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ export type DatedUserAchievement = {
cumulScore: number;
badgeUrl: string;
gameUrl: string;
type: "progression" | "win_condition" | "missable" | null;
};
1 change: 1 addition & 0 deletions src/user/models/dated-user-achievements-response.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface DatedUserAchievementResponseEntity {
CumulScore: number;
BadgeURL: string;
GameURL: string;
Type: "progression" | "win_condition" | "missable" | null;
}

export type DatedUserAchievementsResponse =
Expand Down

0 comments on commit f45d79c

Please sign in to comment.