From ed0008feff3dff6b220e0bb07c65991040bf5135 Mon Sep 17 00:00:00 2001 From: Minh Truong Date: Tue, 27 Feb 2024 15:43:40 -0600 Subject: [PATCH] fix: add badgeName and badgeUrl to AchievementOfTheWeek model (#82) --- src/feed/getAchievementOfTheWeek.test.ts | 37 +++++++++++++------ src/feed/getAchievementOfTheWeek.ts | 4 +- .../models/achievement-of-the-week.model.ts | 2 + ...-achievement-of-the-week-response.model.ts | 2 + 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/feed/getAchievementOfTheWeek.test.ts b/src/feed/getAchievementOfTheWeek.test.ts index 67fc1e6..63228c7 100644 --- a/src/feed/getAchievementOfTheWeek.test.ts +++ b/src/feed/getAchievementOfTheWeek.test.ts @@ -6,7 +6,10 @@ import { setupServer } from "msw/node"; import { apiBaseUrl } from "../utils/internal"; import { buildAuthorization } from "../utils/public"; import { getAchievementOfTheWeek } from "./getAchievementOfTheWeek"; -import type { GetAchievementOfTheWeekResponse } from "./models"; +import type { + AchievementOfTheWeek, + GetAchievementOfTheWeekResponse +} from "./models"; const server = setupServer(); @@ -37,7 +40,9 @@ describe("Function: getAchievementOfTheWeek", () => { TrueRatio: "22", Author: "BigWeedSmokerMan", DateCreated: "2021-08-08 17:47:46", - DateModified: "2021-08-09 12:20:05" + DateModified: "2021-08-09 12:20:05", + BadgeName: "185805", + BadgeURL: "/Badge/185805.png" }, Console: { ID: "39", Title: "Saturn" }, ForumTopic: { ID: "14767" }, @@ -64,8 +69,7 @@ describe("Function: getAchievementOfTheWeek", () => { // ACT const response = await getAchievementOfTheWeek(authorization); - // ASSERT - expect(response).toEqual({ + const expectedResponse: AchievementOfTheWeek = { achievement: { id: 165_062, title: "The True Hero", @@ -74,7 +78,9 @@ describe("Function: getAchievementOfTheWeek", () => { trueRatio: 22, author: "BigWeedSmokerMan", dateCreated: "2021-08-08 17:47:46", - dateModified: "2021-08-09 12:20:05" + dateModified: "2021-08-09 12:20:05", + badgeName: "185805", + badgeUrl: "/Badge/185805.png" }, console: { id: 39, title: "Saturn" }, forumTopic: { id: 14_767 }, @@ -90,7 +96,10 @@ describe("Function: getAchievementOfTheWeek", () => { } ], unlocksCount: 40 - }); + }; + + // ASSERT + expect(response).toEqual(expectedResponse); }); it("properly sets the hardcore boolean value when cleaning properties", async () => { @@ -109,7 +118,9 @@ describe("Function: getAchievementOfTheWeek", () => { TrueRatio: "22", Author: "BigWeedSmokerMan", DateCreated: "2021-08-08 17:47:46", - DateModified: "2021-08-09 12:20:05" + DateModified: "2021-08-09 12:20:05", + BadgeName: "185805", + BadgeURL: "/Badge/185805.png" }, Console: { ID: "39", Title: "Saturn" }, ForumTopic: { ID: "14767" }, @@ -136,8 +147,7 @@ describe("Function: getAchievementOfTheWeek", () => { // ACT const response = await getAchievementOfTheWeek(authorization); - // ASSERT - expect(response).toEqual({ + const expectedResponse: AchievementOfTheWeek = { achievement: { id: 165_062, title: "The True Hero", @@ -146,7 +156,9 @@ describe("Function: getAchievementOfTheWeek", () => { trueRatio: 22, author: "BigWeedSmokerMan", dateCreated: "2021-08-08 17:47:46", - dateModified: "2021-08-09 12:20:05" + dateModified: "2021-08-09 12:20:05", + badgeName: "185805", + badgeUrl: "/Badge/185805.png" }, console: { id: 39, title: "Saturn" }, forumTopic: { id: 14_767 }, @@ -162,6 +174,9 @@ describe("Function: getAchievementOfTheWeek", () => { } ], unlocksCount: 40 - }); + }; + + // ASSERT + expect(response).toEqual(expectedResponse); }); }); diff --git a/src/feed/getAchievementOfTheWeek.ts b/src/feed/getAchievementOfTheWeek.ts index d32dd1f..39426c4 100644 --- a/src/feed/getAchievementOfTheWeek.ts +++ b/src/feed/getAchievementOfTheWeek.ts @@ -36,7 +36,9 @@ import type { * trueRatio: "22", * author: "BigWeedSmokerMan", * dateCreated: "2021-08-08 17:47:46", - * dateModified: "2021-08-09 12:20:05" + * dateModified: "2021-08-09 12:20:05", + * badgeName: "185805", + * badgeUrl: "/Badge/185805.png" * }, * console: { id: "39", title: "Saturn" }, * forumTopic: { id: "14767" }, diff --git a/src/feed/models/achievement-of-the-week.model.ts b/src/feed/models/achievement-of-the-week.model.ts index e5b34bd..3fb2f49 100644 --- a/src/feed/models/achievement-of-the-week.model.ts +++ b/src/feed/models/achievement-of-the-week.model.ts @@ -8,6 +8,8 @@ export interface AchievementOfTheWeek { author: string; dateCreated: string; dateModified: string; + badgeName: string; + badgeUrl: string; }; console: { id: number; title: string }; diff --git a/src/feed/models/get-achievement-of-the-week-response.model.ts b/src/feed/models/get-achievement-of-the-week-response.model.ts index 07d4562..31759af 100644 --- a/src/feed/models/get-achievement-of-the-week-response.model.ts +++ b/src/feed/models/get-achievement-of-the-week-response.model.ts @@ -8,6 +8,8 @@ export interface GetAchievementOfTheWeekResponse { Author: string; DateCreated: string; DateModified: string; + BadgeName: string; + BadgeURL: string; }; Console: { ID: string; Title: string };