diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 86bdccc..108077b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,12 +1,12 @@ module.exports = { parserOptions: { ecmaVersion: 2020, - sourceType: "module" + sourceType: "module", }, env: { browser: true, node: true, - es6: true + es6: true, }, parser: "@typescript-eslint/parser", plugins: ["@typescript-eslint", "simple-import-sort", "import"], @@ -15,7 +15,7 @@ module.exports = { "plugin:@typescript-eslint/recommended", "plugin:sonarjs/recommended", "plugin:unicorn/recommended", - "prettier" + "prettier", ], rules: { "@typescript-eslint/consistent-type-imports": "error", @@ -47,6 +47,6 @@ module.exports = { "unicorn/prefer-node-protocol": "off", "unicorn/prefer-spread": "off", "unicorn/prefer-switch": "off", - "unicorn/prevent-abbreviations": "off" - } + "unicorn/prevent-abbreviations": "off", + }, }; diff --git a/.prettierrc b/.prettierrc index 5271f77..0967ef4 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1 @@ -{ - "tabWidth": 2, - "printWidth": 80, - "trailingComma": "none", - "semi": true, - "useTabs": false, - "singleQuote": false, - "bracketSpacing": true -} +{} diff --git a/commitlint.config.cjs b/commitlint.config.cjs index 2072391..a7f909e 100644 --- a/commitlint.config.cjs +++ b/commitlint.config.cjs @@ -1,4 +1,4 @@ /** @type {import('@commitlint/types').UserConfig} */ module.exports = { - extends: ["@commitlint/config-conventional"] + extends: ["@commitlint/config-conventional"], }; diff --git a/src/__playground.ts b/src/__playground.ts index 59df3ed..3931397 100644 --- a/src/__playground.ts +++ b/src/__playground.ts @@ -34,7 +34,7 @@ const main = async () => { const authorization = buildAuthorization({ userName, webApiKey }); const achievementCount = await getAchievementCount(authorization, { - gameId: 14_402 + gameId: 14_402, }); console.log(achievementCount); }; diff --git a/src/achievement/getAchievementUnlocks.test.ts b/src/achievement/getAchievementUnlocks.test.ts index cd192a7..0a7296e 100644 --- a/src/achievement/getAchievementUnlocks.test.ts +++ b/src/achievement/getAchievementUnlocks.test.ts @@ -23,7 +23,7 @@ describe("Function: getAchievementUnlocks", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementUnlocksResponse = { @@ -35,7 +35,7 @@ describe("Function: getAchievementUnlocks", () => { TrueRatio: "6", Author: "Scott", DateCreated: "2012-11-02 00:03:12", - DateModified: "2022-06-11 16:52:35" + DateModified: "2022-06-11 16:52:35", }, Console: { ID: "1", Title: "Mega Drive" }, Game: { ID: "1", Title: "Sonic the Hedgehog" }, @@ -46,9 +46,9 @@ describe("Function: getAchievementUnlocks", () => { User: "Tiotroll2022", RAPoints: "348", DateAwarded: "2023-01-29 21:45:41", - HardcoreMode: "0" - } - ] + HardcoreMode: "0", + }, + ], }; let requestUrl = ""; @@ -64,7 +64,7 @@ describe("Function: getAchievementUnlocks", () => { const response = await getAchievementUnlocks(authorization, { achievementId: 18_000, count: 1, - offset: 1 + offset: 1, }); // ASSERT @@ -81,7 +81,7 @@ describe("Function: getAchievementUnlocks", () => { trueRatio: 6, author: "Scott", dateCreated: "2012-11-02 00:03:12", - dateModified: "2022-06-11 16:52:35" + dateModified: "2022-06-11 16:52:35", }, console: { id: 1, title: "Mega Drive" }, game: { id: 1, title: "Sonic the Hedgehog" }, @@ -92,9 +92,9 @@ describe("Function: getAchievementUnlocks", () => { user: "Tiotroll2022", raPoints: 348, dateAwarded: "2023-01-29 21:45:41", - hardcoreMode: false - } - ] + hardcoreMode: false, + }, + ], }); }); }); diff --git a/src/achievement/getAchievementUnlocks.ts b/src/achievement/getAchievementUnlocks.ts index afa8259..978a8d9 100644 --- a/src/achievement/getAchievementUnlocks.ts +++ b/src/achievement/getAchievementUnlocks.ts @@ -3,12 +3,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { AchievementUnlocksMetadata, - GetAchievementUnlocksResponse + GetAchievementUnlocksResponse, } from "./models"; /** @@ -76,6 +76,6 @@ export const getAchievementUnlocks = async ( return serializeProperties(rawResponse, { shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"], - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/console/getConsoleIds.test.ts b/src/console/getConsoleIds.test.ts index 8ab3232..0b614bf 100644 --- a/src/console/getConsoleIds.test.ts +++ b/src/console/getConsoleIds.test.ts @@ -25,7 +25,7 @@ describe("Function: getConsoleIds", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetConsoleIdsResponse = [ @@ -33,20 +33,20 @@ describe("Function: getConsoleIds", () => { ID: "1", Name: "Mega Drive", IconURL: - "https://static.retroachievements.org/assets/images/system/md.png" + "https://static.retroachievements.org/assets/images/system/md.png", }, { ID: "2", Name: "Nintendo 64", IconURL: - "https://static.retroachievements.org/assets/images/system/n64.png" + "https://static.retroachievements.org/assets/images/system/n64.png", }, { ID: "3", Name: "SNES", IconURL: - "https://static.retroachievements.org/assets/images/system/snes.png" - } + "https://static.retroachievements.org/assets/images/system/snes.png", + }, ]; server.use( @@ -64,20 +64,20 @@ describe("Function: getConsoleIds", () => { id: 1, name: "Mega Drive", iconUrl: - "https://static.retroachievements.org/assets/images/system/md.png" + "https://static.retroachievements.org/assets/images/system/md.png", }, { id: 2, name: "Nintendo 64", iconUrl: - "https://static.retroachievements.org/assets/images/system/n64.png" + "https://static.retroachievements.org/assets/images/system/n64.png", }, { id: 3, name: "SNES", iconUrl: - "https://static.retroachievements.org/assets/images/system/snes.png" - } + "https://static.retroachievements.org/assets/images/system/snes.png", + }, ]; expect(response).toEqual(expectedResponse); diff --git a/src/console/getConsoleIds.ts b/src/console/getConsoleIds.ts index e843310..bb6f074 100644 --- a/src/console/getConsoleIds.ts +++ b/src/console/getConsoleIds.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { ConsoleId, GetConsoleIdsResponse } from "./models"; @@ -42,6 +42,6 @@ export const getConsoleIds = async ( const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldCastToNumbers: ["ID"] + shouldCastToNumbers: ["ID"], }); }; diff --git a/src/console/getGameList.test.ts b/src/console/getGameList.test.ts index e0f0c02..7b13f94 100644 --- a/src/console/getGameList.test.ts +++ b/src/console/getGameList.test.ts @@ -25,7 +25,7 @@ describe("Function: getGameList", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameListResponse = [ @@ -42,9 +42,9 @@ describe("Function: getGameList", () => { ForumTopicID: 1972, Hashes: [ "32e1a15161ef1f070b023738353bde51", - "9b04970a603ace521c7cca2acaf69804" - ] - } + "9b04970a603ace521c7cca2acaf69804", + ], + }, ]; server.use( @@ -56,7 +56,7 @@ describe("Function: getGameList", () => { // ACT const response = await getGameList(authorization, { consoleId: 1, - shouldRetrieveGameHashes: true + shouldRetrieveGameHashes: true, }); // ASSERT @@ -74,9 +74,9 @@ describe("Function: getGameList", () => { forumTopicId: 1972, hashes: [ "32e1a15161ef1f070b023738353bde51", - "9b04970a603ace521c7cca2acaf69804" - ] - } + "9b04970a603ace521c7cca2acaf69804", + ], + }, ]); }); }); diff --git a/src/console/getGameList.ts b/src/console/getGameList.ts index 0332405..6008682 100644 --- a/src/console/getGameList.ts +++ b/src/console/getGameList.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GameList, GetGameListResponse } from "./models"; @@ -63,7 +63,7 @@ export const getGameList = async ( const { consoleId, shouldOnlyRetrieveGamesWithAchievements, - shouldRetrieveGameHashes + shouldRetrieveGameHashes, } = payload; let callPayload: Record = { i: consoleId }; @@ -71,7 +71,7 @@ export const getGameList = async ( if (shouldOnlyRetrieveGamesWithAchievements !== undefined) { callPayload = { ...callPayload, - f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0 + f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0, }; } @@ -89,6 +89,6 @@ export const getGameList = async ( const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldCastToNumbers: ["ID", "ConsoleID"] + shouldCastToNumbers: ["ID", "ConsoleID"], }); }; diff --git a/src/feed/getAchievementOfTheWeek.test.ts b/src/feed/getAchievementOfTheWeek.test.ts index 63228c7..9d2c16a 100644 --- a/src/feed/getAchievementOfTheWeek.test.ts +++ b/src/feed/getAchievementOfTheWeek.test.ts @@ -8,7 +8,7 @@ import { buildAuthorization } from "../utils/public"; import { getAchievementOfTheWeek } from "./getAchievementOfTheWeek"; import type { AchievementOfTheWeek, - GetAchievementOfTheWeekResponse + GetAchievementOfTheWeekResponse, } from "./models"; const server = setupServer(); @@ -28,7 +28,7 @@ describe("Function: getAchievementOfTheWeek", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementOfTheWeekResponse = { @@ -42,7 +42,7 @@ describe("Function: getAchievementOfTheWeek", () => { DateCreated: "2021-08-08 17:47:46", DateModified: "2021-08-09 12:20:05", BadgeName: "185805", - BadgeURL: "/Badge/185805.png" + BadgeURL: "/Badge/185805.png", }, Console: { ID: "39", Title: "Saturn" }, ForumTopic: { ID: "14767" }, @@ -54,10 +54,10 @@ describe("Function: getAchievementOfTheWeek", () => { User: "Tirbaba2", RAPoints: "72", DateAwarded: "2022-10-10 01:42:19", - HardcoreMode: "1" - } + HardcoreMode: "1", + }, ], - UnlocksCount: "40" + UnlocksCount: "40", }; server.use( @@ -80,7 +80,7 @@ describe("Function: getAchievementOfTheWeek", () => { dateCreated: "2021-08-08 17:47:46", dateModified: "2021-08-09 12:20:05", badgeName: "185805", - badgeUrl: "/Badge/185805.png" + badgeUrl: "/Badge/185805.png", }, console: { id: 39, title: "Saturn" }, forumTopic: { id: 14_767 }, @@ -92,10 +92,10 @@ describe("Function: getAchievementOfTheWeek", () => { user: "Tirbaba2", raPoints: 72, dateAwarded: "2022-10-10 01:42:19", - hardcoreMode: true - } + hardcoreMode: true, + }, ], - unlocksCount: 40 + unlocksCount: 40, }; // ASSERT @@ -106,7 +106,7 @@ describe("Function: getAchievementOfTheWeek", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementOfTheWeekResponse = { @@ -120,7 +120,7 @@ describe("Function: getAchievementOfTheWeek", () => { DateCreated: "2021-08-08 17:47:46", DateModified: "2021-08-09 12:20:05", BadgeName: "185805", - BadgeURL: "/Badge/185805.png" + BadgeURL: "/Badge/185805.png", }, Console: { ID: "39", Title: "Saturn" }, ForumTopic: { ID: "14767" }, @@ -132,10 +132,10 @@ describe("Function: getAchievementOfTheWeek", () => { User: "Tirbaba2", RAPoints: "72", DateAwarded: "2022-10-10 01:42:19", - HardcoreMode: "0" - } + HardcoreMode: "0", + }, ], - UnlocksCount: "40" + UnlocksCount: "40", }; server.use( @@ -158,7 +158,7 @@ describe("Function: getAchievementOfTheWeek", () => { dateCreated: "2021-08-08 17:47:46", dateModified: "2021-08-09 12:20:05", badgeName: "185805", - badgeUrl: "/Badge/185805.png" + badgeUrl: "/Badge/185805.png", }, console: { id: 39, title: "Saturn" }, forumTopic: { id: 14_767 }, @@ -170,10 +170,10 @@ describe("Function: getAchievementOfTheWeek", () => { user: "Tirbaba2", raPoints: 72, dateAwarded: "2022-10-10 01:42:19", - hardcoreMode: false - } + hardcoreMode: false, + }, ], - unlocksCount: 40 + unlocksCount: 40, }; // ASSERT diff --git a/src/feed/getAchievementOfTheWeek.ts b/src/feed/getAchievementOfTheWeek.ts index 39426c4..fa877f7 100644 --- a/src/feed/getAchievementOfTheWeek.ts +++ b/src/feed/getAchievementOfTheWeek.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { AchievementOfTheWeek, - GetAchievementOfTheWeekResponse + GetAchievementOfTheWeekResponse, } from "./models"; /** @@ -75,8 +75,8 @@ export const getAchievementOfTheWeek = async ( "TrueRatio", "TotalPlayers", "RAPoints", - "UnlocksCount" + "UnlocksCount", ], - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/feed/getActiveClaims.test.ts b/src/feed/getActiveClaims.test.ts index 6d59486..500ed4a 100644 --- a/src/feed/getActiveClaims.test.ts +++ b/src/feed/getActiveClaims.test.ts @@ -25,7 +25,7 @@ describe("Function: getActiveClaims", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetSetClaimsResponse = [ @@ -46,8 +46,8 @@ describe("Function: getActiveClaims", () => { DoneTime: "2023-01-03 20:29:45", Updated: "2022-10-03 20:29:45", MinutesLeft: 112_285, - UserIsJrDev: 1 - } + UserIsJrDev: 1, + }, ]; server.use( @@ -78,8 +78,8 @@ describe("Function: getActiveClaims", () => { doneTime: "2023-01-03 20:29:45", updated: "2022-10-03 20:29:45", minutesLeft: 112_285, - userIsJrDev: true - } + userIsJrDev: true, + }, ]); }); }); diff --git a/src/feed/getActiveClaims.ts b/src/feed/getActiveClaims.ts index 7da4fef..2846438 100644 --- a/src/feed/getActiveClaims.ts +++ b/src/feed/getActiveClaims.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetSetClaimsResponse, SetClaim } from "./models"; @@ -56,6 +56,6 @@ export const getActiveClaims = async ( const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldMapToBooleans: ["UserIsJrDev"] + shouldMapToBooleans: ["UserIsJrDev"], }); }; diff --git a/src/feed/getClaims.test.ts b/src/feed/getClaims.test.ts index 8559ea1..26506d9 100644 --- a/src/feed/getClaims.test.ts +++ b/src/feed/getClaims.test.ts @@ -25,7 +25,7 @@ describe("Function: getClaims", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetSetClaimsResponse = [ @@ -46,8 +46,8 @@ describe("Function: getClaims", () => { DoneTime: "2023-01-03 20:29:45", Updated: "2022-10-03 20:29:45", MinutesLeft: 112_285, - UserIsJrDev: 1 - } + UserIsJrDev: 1, + }, ]; server.use( @@ -78,8 +78,8 @@ describe("Function: getClaims", () => { doneTime: "2023-01-03 20:29:45", updated: "2022-10-03 20:29:45", minutesLeft: 112_285, - userIsJrDev: true - } + userIsJrDev: true, + }, ]); }); }); diff --git a/src/feed/getClaims.ts b/src/feed/getClaims.ts index 460a240..69b4548 100644 --- a/src/feed/getClaims.ts +++ b/src/feed/getClaims.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetSetClaimsResponse, SetClaim } from "./models"; @@ -16,18 +16,18 @@ export const getClaims = async ( const { claimKind } = payload; const url = buildRequestUrl(apiBaseUrl, "/API_GetClaims.php", authorization, { - k: claimKindValueMap[claimKind] + k: claimKindValueMap[claimKind], }); const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldMapToBooleans: ["UserIsJrDev"] + shouldMapToBooleans: ["UserIsJrDev"], }); }; const claimKindValueMap: Record = { completed: "1", dropped: "2", - expired: "3" + expired: "3", }; diff --git a/src/feed/getTopTenUsers.test.ts b/src/feed/getTopTenUsers.test.ts index 1d8ae12..5680b1e 100644 --- a/src/feed/getTopTenUsers.test.ts +++ b/src/feed/getTopTenUsers.test.ts @@ -23,7 +23,7 @@ describe("Function: getTopTenUsers", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetTopTenUsersResponse = [ @@ -36,7 +36,7 @@ describe("Function: getTopTenUsers", () => { { "1": "donutweegee", "2": "204701", "3": "587221" }, { "1": "AmericanNinja", "2": "202980", "3": "567618" }, { "1": "Infernum", "2": "202171", "3": "689967" }, - { "1": "FabricioPrie", "2": "196974", "3": "450436" } + { "1": "FabricioPrie", "2": "196974", "3": "450436" }, ]; server.use( @@ -53,49 +53,49 @@ describe("Function: getTopTenUsers", () => { { userName: "MaxMilyin", totalPoints: 346_289, - totalRatioPoints: 995_092 + totalRatioPoints: 995_092, }, { userName: "HippopotamusRex", totalPoints: 312_118, - totalRatioPoints: 1_151_351 + totalRatioPoints: 1_151_351, }, { userName: "Sarconius", totalPoints: 257_862, - totalRatioPoints: 1_181_770 + totalRatioPoints: 1_181_770, }, { userName: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 }, { userName: "Andrey199650", totalPoints: 240_101, - totalRatioPoints: 567_522 + totalRatioPoints: 567_522, }, { userName: "Wendigo", totalPoints: 227_903, - totalRatioPoints: 1_099_685 + totalRatioPoints: 1_099_685, }, { userName: "donutweegee", totalPoints: 204_701, - totalRatioPoints: 587_221 + totalRatioPoints: 587_221, }, { userName: "AmericanNinja", totalPoints: 202_980, - totalRatioPoints: 567_618 + totalRatioPoints: 567_618, }, { userName: "Infernum", totalPoints: 202_171, - totalRatioPoints: 689_967 + totalRatioPoints: 689_967, }, { userName: "FabricioPrie", totalPoints: 196_974, - totalRatioPoints: 450_436 - } + totalRatioPoints: 450_436, + }, ]); }); }); diff --git a/src/feed/getTopTenUsers.ts b/src/feed/getTopTenUsers.ts index cabac91..cd2244c 100644 --- a/src/feed/getTopTenUsers.ts +++ b/src/feed/getTopTenUsers.ts @@ -3,7 +3,7 @@ import type { AuthObject } from "../utils/public"; import type { GetTopTenUsersResponse, TopTenUsers, - TopTenUsersEntity + TopTenUsersEntity, } from "./models"; /** @@ -43,7 +43,7 @@ export const getTopTenUsers = async ( sanitizedTopTenUsers.push({ userName: rawUser["1"], totalPoints: Number(rawUser["2"]), - totalRatioPoints: Number(rawUser["3"]) + totalRatioPoints: Number(rawUser["3"]), }); } diff --git a/src/feed/models/claim-set-type.enum.ts b/src/feed/models/claim-set-type.enum.ts index bd0c5dd..cc4c25d 100644 --- a/src/feed/models/claim-set-type.enum.ts +++ b/src/feed/models/claim-set-type.enum.ts @@ -1,4 +1,4 @@ export enum ClaimSetType { NewSet = 0, - Revision = 1 + Revision = 1, } diff --git a/src/feed/models/claim-status.enum.ts b/src/feed/models/claim-status.enum.ts index ac8624a..5d8fae4 100644 --- a/src/feed/models/claim-status.enum.ts +++ b/src/feed/models/claim-status.enum.ts @@ -1,5 +1,5 @@ export enum ClaimStatus { Active = 0, Complete = 1, - Dropped = 2 + Dropped = 2, } diff --git a/src/feed/models/claim-type.enum.ts b/src/feed/models/claim-type.enum.ts index adbf4e7..300f507 100644 --- a/src/feed/models/claim-type.enum.ts +++ b/src/feed/models/claim-type.enum.ts @@ -1,4 +1,4 @@ export enum ClaimType { Primary = 0, - Collaboration = 1 + Collaboration = 1, } diff --git a/src/game/getAchievementCount.test.ts b/src/game/getAchievementCount.test.ts index 6b63cea..2087cb0 100644 --- a/src/game/getAchievementCount.test.ts +++ b/src/game/getAchievementCount.test.ts @@ -23,12 +23,12 @@ describe("Function: getAchievementCount", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementCountResponse = { GameID: 8, - AchievementIDs: [1, 2, 3, 4, 5] + AchievementIDs: [1, 2, 3, 4, 5], }; server.use( @@ -43,7 +43,7 @@ describe("Function: getAchievementCount", () => { // ASSERT expect(response).toEqual({ gameId: 8, - achievementIds: [1, 2, 3, 4, 5] + achievementIds: [1, 2, 3, 4, 5], }); }); }); diff --git a/src/game/getAchievementCount.ts b/src/game/getAchievementCount.ts index f92c6d6..72c691f 100644 --- a/src/game/getAchievementCount.ts +++ b/src/game/getAchievementCount.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { AchievementCount, GetAchievementCountResponse } from "./models"; diff --git a/src/game/getAchievementDistribution.test.ts b/src/game/getAchievementDistribution.test.ts index e50703a..7ff4853 100644 --- a/src/game/getAchievementDistribution.test.ts +++ b/src/game/getAchievementDistribution.test.ts @@ -24,7 +24,7 @@ describe("Function: getAchievementDistribution", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementDistributionResponse = { @@ -32,7 +32,7 @@ describe("Function: getAchievementDistribution", () => { "2": 10, "3": 8, "4": 4, - "5": 1 + "5": 1, }; let requestUrl = ""; @@ -47,7 +47,7 @@ describe("Function: getAchievementDistribution", () => { // ACT const response = await getAchievementDistribution(authorization, { - gameId: 14_402 + gameId: 14_402, }); // ASSERT @@ -62,7 +62,7 @@ describe("Function: getAchievementDistribution", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementDistributionResponse = { @@ -70,7 +70,7 @@ describe("Function: getAchievementDistribution", () => { "2": 10, "3": 8, "4": 4, - "5": 1 + "5": 1, }; let requestUrl = ""; @@ -85,7 +85,7 @@ describe("Function: getAchievementDistribution", () => { // ACT const response = await getAchievementDistribution(authorization, { gameId: 14_402, - flags: AchievementDistributionFlags.UnofficialAchievements + flags: AchievementDistributionFlags.UnofficialAchievements, }); // ASSERT @@ -102,7 +102,7 @@ describe("Function: getAchievementDistribution", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementDistributionResponse = { @@ -110,7 +110,7 @@ describe("Function: getAchievementDistribution", () => { "2": 10, "3": 8, "4": 4, - "5": 1 + "5": 1, }; let requestUrl = ""; @@ -125,7 +125,7 @@ describe("Function: getAchievementDistribution", () => { // ACT const response = await getAchievementDistribution(authorization, { gameId: 14_402, - hardcore: true + hardcore: true, }); // ASSERT @@ -139,7 +139,7 @@ describe("Function: getAchievementDistribution", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetAchievementDistributionResponse = { @@ -147,7 +147,7 @@ describe("Function: getAchievementDistribution", () => { "2": 10, "3": 8, "4": 4, - "5": 1 + "5": 1, }; let requestUrl = ""; @@ -162,7 +162,7 @@ describe("Function: getAchievementDistribution", () => { // ACT const response = await getAchievementDistribution(authorization, { gameId: 14_402, - hardcore: false + hardcore: false, }); // ASSERT diff --git a/src/game/getAchievementDistribution.ts b/src/game/getAchievementDistribution.ts index a5d6203..5a85997 100644 --- a/src/game/getAchievementDistribution.ts +++ b/src/game/getAchievementDistribution.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { AchievementDistributionFlags, - GetAchievementDistributionResponse + GetAchievementDistributionResponse, } from "./models"; /** @@ -84,6 +84,6 @@ export const getAchievementDistribution = async ( ); return await call({ - url + url, }); }; diff --git a/src/game/getGame.test.ts b/src/game/getGame.test.ts index e4c5208..a906fe5 100644 --- a/src/game/getGame.test.ts +++ b/src/game/getGame.test.ts @@ -25,7 +25,7 @@ describe("Function: getGame", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameResponse = { @@ -45,7 +45,7 @@ describe("Function: getGame", () => { Genre: "Racing", Released: "1980", GameTitle: "Dragster", - Console: "Atari 2600" + Console: "Atari 2600", }; server.use( @@ -75,7 +75,7 @@ describe("Function: getGame", () => { genre: "Racing", released: "1980", gameTitle: "Dragster", - console: "Atari 2600" + console: "Atari 2600", }); }); }); diff --git a/src/game/getGame.ts b/src/game/getGame.ts index b296556..17e127a 100644 --- a/src/game/getGame.ts +++ b/src/game/getGame.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { Game, GetGameResponse } from "./models"; @@ -58,12 +58,12 @@ export const getGame = async ( const { gameId } = payload; const url = buildRequestUrl(apiBaseUrl, "/API_GetGame.php", authorization, { - i: gameId + i: gameId, }); const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldCastToNumbers: ["ID", "ForumTopicID", "ConsoleID", "Flags"] + shouldCastToNumbers: ["ID", "ForumTopicID", "ConsoleID", "Flags"], }); }; diff --git a/src/game/getGameExtended.test.ts b/src/game/getGameExtended.test.ts index e0a5f39..23ec396 100644 --- a/src/game/getGameExtended.test.ts +++ b/src/game/getGameExtended.test.ts @@ -25,7 +25,7 @@ describe("Function: getGameExtended", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameExtendedResponse = { @@ -63,9 +63,9 @@ describe("Function: getGameExtended", () => { DateCreated: "2019-07-31 18:49:57", BadgeName: "85541", DisplayOrder: "0", - MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582" - } - } + MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582", + }, + }, }; server.use( @@ -113,9 +113,9 @@ describe("Function: getGameExtended", () => { dateCreated: "2019-07-31 18:49:57", badgeName: "85541", displayOrder: 0, - memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582" - } - } + memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582", + }, + }, }); }); }); diff --git a/src/game/getGameExtended.ts b/src/game/getGameExtended.ts index 1def77b..d7db7ae 100644 --- a/src/game/getGameExtended.ts +++ b/src/game/getGameExtended.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GameExtended, GetGameExtendedResponse } from "./models"; @@ -78,7 +78,7 @@ export const getGameExtended = async ( const { gameId, isRequestingUnofficialAchievements } = payload; const params: Record = { - i: gameId + i: gameId, }; if (isRequestingUnofficialAchievements) { @@ -103,7 +103,7 @@ export const getGameExtended = async ( "TrueRatio", "DisplayOrder", "NumDistinctPlayersCasual", - "NumDistinctPlayersHardcore" - ] + "NumDistinctPlayersHardcore", + ], }); }; diff --git a/src/game/getGameRankAndScore.test.ts b/src/game/getGameRankAndScore.test.ts index fc2ef3d..5c6d60b 100644 --- a/src/game/getGameRankAndScore.test.ts +++ b/src/game/getGameRankAndScore.test.ts @@ -25,7 +25,7 @@ describe("Function: getGameRankAndScore", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameRankAndScoreResponse = [ @@ -33,8 +33,8 @@ describe("Function: getGameRankAndScore", () => { User: "Arekdias", TotalScore: "189", LastAward: "2020-10-10 22:43:32", - Rank: 1 - } + Rank: 1, + }, ]; server.use( @@ -46,7 +46,7 @@ describe("Function: getGameRankAndScore", () => { // ACT const response = await getGameRankAndScore(authorization, { gameId: 14_402, - type: "high-scores" + type: "high-scores", }); // ASSERT @@ -55,8 +55,8 @@ describe("Function: getGameRankAndScore", () => { user: "Arekdias", totalScore: 189, lastAward: "2020-10-10 22:43:32", - rank: 1 - } + rank: 1, + }, ]); }); }); diff --git a/src/game/getGameRankAndScore.ts b/src/game/getGameRankAndScore.ts index b5ad9a8..78726e5 100644 --- a/src/game/getGameRankAndScore.ts +++ b/src/game/getGameRankAndScore.ts @@ -3,12 +3,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GameRankAndScoreEntity, - GetGameRankAndScoreResponse + GetGameRankAndScoreResponse, } from "./models"; /** @@ -55,13 +55,13 @@ export const getGameRankAndScore = async ( authorization, { g: gameId, - t: type === "latest-masters" ? 1 : 0 + t: type === "latest-masters" ? 1 : 0, } ); const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldCastToNumbers: ["TotalScore"] + shouldCastToNumbers: ["TotalScore"], }); }; diff --git a/src/game/getGameRating.test.ts b/src/game/getGameRating.test.ts index 3a03957..e1ed339 100644 --- a/src/game/getGameRating.test.ts +++ b/src/game/getGameRating.test.ts @@ -23,7 +23,7 @@ describe("Function: getGameRating", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameRatingResponse = { @@ -32,8 +32,8 @@ describe("Function: getGameRating", () => { Game: 3.1875, Achievements: 0, GameNumVotes: 16, - AchievementsNumVotes: 0 - } + AchievementsNumVotes: 0, + }, }; server.use( @@ -52,8 +52,8 @@ describe("Function: getGameRating", () => { game: 3.1875, achievements: 0, gameNumVotes: 16, - achievementsNumVotes: 0 - } + achievementsNumVotes: 0, + }, }); }); }); diff --git a/src/game/getGameRating.ts b/src/game/getGameRating.ts index 795aa88..99ff07f 100644 --- a/src/game/getGameRating.ts +++ b/src/game/getGameRating.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GameRating, GetGameRatingResponse } from "./models"; diff --git a/src/game/models/achievement-distribution-flags.enum.ts b/src/game/models/achievement-distribution-flags.enum.ts index be9b1bd..db9ad20 100644 --- a/src/game/models/achievement-distribution-flags.enum.ts +++ b/src/game/models/achievement-distribution-flags.enum.ts @@ -1,4 +1,4 @@ export enum AchievementDistributionFlags { CoreAchievements = 3, - UnofficialAchievements = 5 + UnofficialAchievements = 5, } diff --git a/src/game/models/get-game-extended-response.model.ts b/src/game/models/get-game-extended-response.model.ts index a75bf5b..44d3189 100644 --- a/src/game/models/get-game-extended-response.model.ts +++ b/src/game/models/get-game-extended-response.model.ts @@ -4,7 +4,7 @@ enum GameExtendedClaimType { Primary = "0", - Collaboration = "1" + Collaboration = "1", } export interface GameExtendedRawAchievementEntity { diff --git a/src/ticket/getTicketData.test.ts b/src/ticket/getTicketData.test.ts index fb727ef..8e4e751 100644 --- a/src/ticket/getTicketData.test.ts +++ b/src/ticket/getTicketData.test.ts @@ -10,7 +10,7 @@ import type { MostTicketedGamesResponse, RecentTicketsResponse, ResponseTicketEntity, - TicketsByUserResponse + TicketsByUserResponse, } from "./models"; const server = setupServer(); @@ -29,7 +29,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: ResponseTicketEntity = { @@ -54,7 +54,7 @@ describe("Function: getTicketData", () => { ResolvedBy: "televandalist", ReportStateDescription: "Resolved", ReportTypeDescription: "Triggered at the wrong time", - URL: "https://retroachievements.org/ticketmanager.php?i=10000" + URL: "https://retroachievements.org/ticketmanager.php?i=10000", }; server.use( @@ -89,7 +89,7 @@ describe("Function: getTicketData", () => { resolvedBy: "televandalist", reportStateDescription: "Resolved", reportTypeDescription: "Triggered at the wrong time", - url: "https://retroachievements.org/ticketmanager.php?i=10000" + url: "https://retroachievements.org/ticketmanager.php?i=10000", }); }); @@ -97,7 +97,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: RecentTicketsResponse = { @@ -128,11 +128,11 @@ describe("Function: getTicketData", () => { ResolvedBy: null, ReportState: "1", ReportStateDescription: "Open", - ReportTypeDescription: "Did not trigger" - } + ReportTypeDescription: "Did not trigger", + }, ], OpenTickets: 715, - URL: "https://retroachievements.org/ticketmanager.php" + URL: "https://retroachievements.org/ticketmanager.php", }; server.use( @@ -173,11 +173,11 @@ describe("Function: getTicketData", () => { resolvedBy: null, reportState: 1, reportStateDescription: "Open", - reportTypeDescription: "Did not trigger" - } + reportTypeDescription: "Did not trigger", + }, ], openTickets: 715, - url: "https://retroachievements.org/ticketmanager.php" + url: "https://retroachievements.org/ticketmanager.php", }); }); @@ -185,7 +185,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: MostTicketedGamesResponse = { @@ -195,17 +195,17 @@ describe("Function: getTicketData", () => { GameTitle: "Driver 2: The Wheelman Is Back", GameIcon: "/Images/046592.png", Console: "PlayStation", - OpenTickets: "16" + OpenTickets: "16", }, { GameID: "5515", GameTitle: "Ninja Ryuuken Den | Ninja Gaiden", GameIcon: "/Images/020735.png", Console: "PC Engine", - OpenTickets: "15" - } + OpenTickets: "15", + }, ], - URL: "https://retroachievements.org/ticketmanager.php?f=1" + URL: "https://retroachievements.org/ticketmanager.php?f=1", }; server.use( @@ -216,7 +216,7 @@ describe("Function: getTicketData", () => { // ACT const response = await getTicketData(authorization, { - isGettingMostTicketedGames: true + isGettingMostTicketedGames: true, }); // ASSERT @@ -227,17 +227,17 @@ describe("Function: getTicketData", () => { gameTitle: "Driver 2: The Wheelman Is Back", gameIcon: "/Images/046592.png", console: "PlayStation", - openTickets: 16 + openTickets: 16, }, { gameId: 5515, gameTitle: "Ninja Ryuuken Den | Ninja Gaiden", gameIcon: "/Images/020735.png", console: "PC Engine", - openTickets: 15 - } + openTickets: 15, + }, ], - url: "https://retroachievements.org/ticketmanager.php?f=1" + url: "https://retroachievements.org/ticketmanager.php?f=1", }); }); @@ -245,7 +245,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: TicketsByUserResponse = { @@ -254,7 +254,7 @@ describe("Function: getTicketData", () => { Closed: 18, Resolved: 51, Total: 69, - URL: "https://retroachievements.org/ticketmanager.php?u=Jamiras" + URL: "https://retroachievements.org/ticketmanager.php?u=Jamiras", }; server.use( @@ -273,7 +273,7 @@ describe("Function: getTicketData", () => { closed: 18, resolved: 51, total: 69, - url: "https://retroachievements.org/ticketmanager.php?u=Jamiras" + url: "https://retroachievements.org/ticketmanager.php?u=Jamiras", }); }); @@ -281,7 +281,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GameTicketsResponse = { @@ -289,7 +289,7 @@ describe("Function: getTicketData", () => { GameTitle: "Rampage 2: Universal Tour", ConsoleName: "Nintendo 64", OpenTickets: 8, - URL: "https://retroachievements.org/ticketmanager.php?g=10329" + URL: "https://retroachievements.org/ticketmanager.php?g=10329", }; server.use( @@ -307,7 +307,7 @@ describe("Function: getTicketData", () => { gameTitle: "Rampage 2: Universal Tour", consoleName: "Nintendo 64", openTickets: 8, - url: "https://retroachievements.org/ticketmanager.php?g=10329" + url: "https://retroachievements.org/ticketmanager.php?g=10329", }); }); @@ -315,7 +315,7 @@ describe("Function: getTicketData", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: AchievementTicketStatsResponse = { @@ -323,7 +323,7 @@ describe("Function: getTicketData", () => { AchievementTitle: "Blue Potaras Collector", AchievementDescription: "Unlock all Ability Type Z-Items", URL: "https://retroachievements.org/ticketmanager.php?a=283331", - OpenTickets: 1 + OpenTickets: 1, }; server.use( @@ -334,7 +334,7 @@ describe("Function: getTicketData", () => { // ACT const response = await getTicketData(authorization, { - achievementId: 283_331 + achievementId: 283_331, }); // ASSERT @@ -343,7 +343,7 @@ describe("Function: getTicketData", () => { achievementTitle: "Blue Potaras Collector", achievementDescription: "Unlock all Ability Type Z-Items", url: "https://retroachievements.org/ticketmanager.php?a=283331", - openTickets: 1 + openTickets: 1, }); }); }); diff --git a/src/ticket/getTicketData.ts b/src/ticket/getTicketData.ts index 3fd2997..4593546 100644 --- a/src/ticket/getTicketData.ts +++ b/src/ticket/getTicketData.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { @@ -12,7 +12,7 @@ import type { MostTicketedGames, RecentTickets, TicketEntity, - UserTicketStats + UserTicketStats, } from "./models"; interface GetTicketDataAllPayloadValues { @@ -222,9 +222,9 @@ export async function getTicketData( "GameID", "ReportType", "ReportState", - "OpenTickets" + "OpenTickets", ], - shouldMapToBooleans: ["Hardcore"] + shouldMapToBooleans: ["Hardcore"], }); } @@ -238,7 +238,7 @@ const buildGetTicketDataQueryParams = ( gameId, isGettingTicketsForUnofficialAchievements, shouldReturnTicketsList, - achievementId + achievementId, } = payload; let queryParams: Record = {}; diff --git a/src/user/getAchievementsEarnedBetween.test.ts b/src/user/getAchievementsEarnedBetween.test.ts index fc6279a..b4304db 100644 --- a/src/user/getAchievementsEarnedBetween.test.ts +++ b/src/user/getAchievementsEarnedBetween.test.ts @@ -6,7 +6,7 @@ import { buildAuthorization } from "../utils/public"; import { getAchievementsEarnedBetween } from "./getAchievementsEarnedBetween"; import type { DatedUserAchievement, - DatedUserAchievementsResponse + DatedUserAchievementsResponse, } from "./models"; const server = setupServer(); @@ -26,7 +26,7 @@ describe("Function: getAchievementsEarnedBetween", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: DatedUserAchievementsResponse = [ @@ -46,8 +46,8 @@ describe("Function: getAchievementsEarnedBetween", () => { CumulScore: 40, BadgeURL: "/Badge/193797.png", GameURL: "/game/3571", - Type: "progression" - } + Type: "progression", + }, ]; server.use( @@ -60,7 +60,7 @@ describe("Function: getAchievementsEarnedBetween", () => { const response = await getAchievementsEarnedBetween(authorization, { userName: "xelnia", fromDate: new Date("2022-10-12"), - toDate: new Date("2022-10-13") + toDate: new Date("2022-10-13"), }); const expectedResponse: DatedUserAchievement[] = [ @@ -80,8 +80,8 @@ describe("Function: getAchievementsEarnedBetween", () => { cumulScore: 40, badgeUrl: "/Badge/193797.png", gameUrl: "/game/3571", - type: "progression" - } + type: "progression", + }, ]; // ASSERT diff --git a/src/user/getAchievementsEarnedBetween.ts b/src/user/getAchievementsEarnedBetween.ts index a166bf5..03368be 100644 --- a/src/user/getAchievementsEarnedBetween.ts +++ b/src/user/getAchievementsEarnedBetween.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { DatedUserAchievement, - DatedUserAchievementsResponse + DatedUserAchievementsResponse, } from "./models"; /** @@ -76,7 +76,7 @@ export const getAchievementsEarnedBetween = async ( { u: userName, f: (fromDate.getTime() / 1000).toFixed(0), - t: (toDate.getTime() / 1000).toFixed(0) + t: (toDate.getTime() / 1000).toFixed(0), } ); @@ -84,6 +84,6 @@ export const getAchievementsEarnedBetween = async ( return serializeProperties(rawResponse, { shouldCastToNumbers: ["AchievementID", "Points", "GameID"], - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/user/getAchievementsEarnedOnDay.test.ts b/src/user/getAchievementsEarnedOnDay.test.ts index c583400..6a3ccba 100644 --- a/src/user/getAchievementsEarnedOnDay.test.ts +++ b/src/user/getAchievementsEarnedOnDay.test.ts @@ -6,7 +6,7 @@ import { buildAuthorization } from "../utils/public"; import { getAchievementsEarnedOnDay } from "./getAchievementsEarnedOnDay"; import type { DatedUserAchievement, - DatedUserAchievementsResponse + DatedUserAchievementsResponse, } from "./models"; const server = setupServer(); @@ -26,7 +26,7 @@ describe("Function: getAchievementsEarnedOnDay", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: DatedUserAchievementsResponse = [ @@ -46,8 +46,8 @@ describe("Function: getAchievementsEarnedOnDay", () => { CumulScore: 40, BadgeURL: "/Badge/193797.png", GameURL: "/game/3571", - Type: null - } + Type: null, + }, ]; server.use( @@ -59,7 +59,7 @@ describe("Function: getAchievementsEarnedOnDay", () => { // ACT const response = await getAchievementsEarnedOnDay(authorization, { userName: "xelnia", - onDate: new Date("2022-10-12") + onDate: new Date("2022-10-12"), }); const expectedResponse: DatedUserAchievement[] = [ @@ -79,8 +79,8 @@ describe("Function: getAchievementsEarnedOnDay", () => { cumulScore: 40, badgeUrl: "/Badge/193797.png", gameUrl: "/game/3571", - type: null - } + type: null, + }, ]; // ASSERT diff --git a/src/user/getAchievementsEarnedOnDay.ts b/src/user/getAchievementsEarnedOnDay.ts index dbed6cd..890cbc7 100644 --- a/src/user/getAchievementsEarnedOnDay.ts +++ b/src/user/getAchievementsEarnedOnDay.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { DatedUserAchievement, - DatedUserAchievementsResponse + DatedUserAchievementsResponse, } from "./models"; /** @@ -75,7 +75,7 @@ export const getAchievementsEarnedOnDay = async ( { u: userName, // YYYY-MM-DD - d: `${onDate.getFullYear()}-${onDate.getMonth() + 1}-${onDate.getDate()}` + d: `${onDate.getFullYear()}-${onDate.getMonth() + 1}-${onDate.getDate()}`, } ); @@ -83,6 +83,6 @@ export const getAchievementsEarnedOnDay = async ( return serializeProperties(rawResponse, { shouldCastToNumbers: ["AchievementID", "Points", "GameID"], - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/user/getGameInfoAndUserProgress.test.ts b/src/user/getGameInfoAndUserProgress.test.ts index 84fa6a2..6d360ce 100644 --- a/src/user/getGameInfoAndUserProgress.test.ts +++ b/src/user/getGameInfoAndUserProgress.test.ts @@ -25,7 +25,7 @@ describe("Function: getGameInfoAndUserProgress", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetGameInfoAndUserProgressResponse = { @@ -64,13 +64,13 @@ describe("Function: getGameInfoAndUserProgress", () => { DisplayOrder: "0", MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582", DateEarned: "2022-08-23 22:56:38", - DateEarnedHardcore: "2022-08-23 22:56:38" - } + DateEarnedHardcore: "2022-08-23 22:56:38", + }, }, NumAwardedToUser: 12, NumAwardedToUserHardcore: 12, UserCompletion: "100.00%", - UserCompletionHardcore: "100.00%" + UserCompletionHardcore: "100.00%", }; server.use( @@ -82,7 +82,7 @@ describe("Function: getGameInfoAndUserProgress", () => { // ACT const response = await getGameInfoAndUserProgress(authorization, { gameId: 14_402, - userName: "xelnia" + userName: "xelnia", }); // ASSERT @@ -122,13 +122,13 @@ describe("Function: getGameInfoAndUserProgress", () => { displayOrder: 0, memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582", dateEarned: "2022-08-23 22:56:38", - dateEarnedHardcore: "2022-08-23 22:56:38" - } + dateEarnedHardcore: "2022-08-23 22:56:38", + }, }, numAwardedToUser: 12, numAwardedToUserHardcore: 12, userCompletion: "100.00%", - userCompletionHardcore: "100.00%" + userCompletionHardcore: "100.00%", }); }); }); diff --git a/src/user/getGameInfoAndUserProgress.ts b/src/user/getGameInfoAndUserProgress.ts index 9907b2b..12c5396 100644 --- a/src/user/getGameInfoAndUserProgress.ts +++ b/src/user/getGameInfoAndUserProgress.ts @@ -3,12 +3,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GameInfoAndUserProgress, - GetGameInfoAndUserProgressResponse + GetGameInfoAndUserProgressResponse, } from "./models"; /** @@ -97,7 +97,7 @@ export const getGameInfoAndUserProgress = async ( authorization, { g: gameId, - u: userName + u: userName, } ); @@ -113,7 +113,7 @@ export const getGameInfoAndUserProgress = async ( "DisplayOrder", "NumDistinctPlayersCasual", "NumDistinctPlayersHardcore", - "Released" - ] + "Released", + ], }); }; diff --git a/src/user/getUserAwards.test.ts b/src/user/getUserAwards.test.ts index 1b2c45d..94a7541 100644 --- a/src/user/getUserAwards.test.ts +++ b/src/user/getUserAwards.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserAwards", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserAwardsResponse = { @@ -45,9 +45,9 @@ describe("Function: getUserAwards", () => { Title: "WarioWare, Inc.: Mega Microgames!", ConsoleName: "Game Boy Advance", Flags: null, - ImageIcon: "/Images/034678.png" - } - ] + ImageIcon: "/Images/034678.png", + }, + ], }; server.use( @@ -79,9 +79,9 @@ describe("Function: getUserAwards", () => { title: "WarioWare, Inc.: Mega Microgames!", consoleName: "Game Boy Advance", flags: null, - imageIcon: "/Images/034678.png" - } - ] + imageIcon: "/Images/034678.png", + }, + ], }); }); }); diff --git a/src/user/getUserAwards.ts b/src/user/getUserAwards.ts index c1f752f..6a3638d 100644 --- a/src/user/getUserAwards.ts +++ b/src/user/getUserAwards.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserAwardsResponse, UserAwards } from "./models"; diff --git a/src/user/getUserClaims.test.ts b/src/user/getUserClaims.test.ts index 32da573..bb9b850 100644 --- a/src/user/getUserClaims.test.ts +++ b/src/user/getUserClaims.test.ts @@ -24,7 +24,7 @@ describe("Function: getUserClaims", () => { it("given a username, retrieves a list of achievement set claims for the user", async () => { const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserClaimsResponse = [ @@ -43,8 +43,8 @@ describe("Function: getUserClaims", () => { Created: "2017-08-20 00:00:00", DoneTime: "2017-08-20 00:00:00", Updated: "2022-06-28 17:15:59", - MinutesLeft: "-2862348" - } + MinutesLeft: "-2862348", + }, ]; server.use( @@ -55,7 +55,7 @@ describe("Function: getUserClaims", () => { // ACT const response = await getUserClaims(authorization, { - userName: "Jamiras" + userName: "Jamiras", }); // ASSERT @@ -75,8 +75,8 @@ describe("Function: getUserClaims", () => { created: "2017-08-20 00:00:00", doneTime: "2017-08-20 00:00:00", updated: "2022-06-28 17:15:59", - minutesLeft: -2_862_348 - } + minutesLeft: -2_862_348, + }, ]); }); }); diff --git a/src/user/getUserClaims.ts b/src/user/getUserClaims.ts index 873f196..d47d5f1 100644 --- a/src/user/getUserClaims.ts +++ b/src/user/getUserClaims.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserClaimsResponse, UserClaims } from "./models"; @@ -53,7 +53,7 @@ export const getUserClaims = async ( "Status", "Extension", "Special", - "MinutesLeft" - ] + "MinutesLeft", + ], }); }; diff --git a/src/user/getUserCompletedGames.test.ts b/src/user/getUserCompletedGames.test.ts index b91e0e4..d062c2c 100644 --- a/src/user/getUserCompletedGames.test.ts +++ b/src/user/getUserCompletedGames.test.ts @@ -25,7 +25,7 @@ describe("Function: getUserCompletedGames", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserCompletedGamesResponse = [ @@ -38,7 +38,7 @@ describe("Function: getUserCompletedGames", () => { MaxPossible: "26", NumAwarded: "12", PctWon: "0.4615", - HardcoreMode: "0" + HardcoreMode: "0", }, { GameID: "1881", @@ -49,8 +49,8 @@ describe("Function: getUserCompletedGames", () => { MaxPossible: "26", NumAwarded: "12", PctWon: "0.4615", - HardcoreMode: "1" - } + HardcoreMode: "1", + }, ]; server.use( @@ -61,7 +61,7 @@ describe("Function: getUserCompletedGames", () => { // ACT const response = await getUserCompletedGames(authorization, { - userName: "xelnia" + userName: "xelnia", }); // ASSERT @@ -75,7 +75,7 @@ describe("Function: getUserCompletedGames", () => { maxPossible: 26, numAwarded: 12, pctWon: 0.4615, - hardcoreMode: false + hardcoreMode: false, }, { gameId: 1881, @@ -86,8 +86,8 @@ describe("Function: getUserCompletedGames", () => { maxPossible: 26, numAwarded: 12, pctWon: 0.4615, - hardcoreMode: true - } + hardcoreMode: true, + }, ]); }); }); diff --git a/src/user/getUserCompletedGames.ts b/src/user/getUserCompletedGames.ts index 095c9b5..c675a0e 100644 --- a/src/user/getUserCompletedGames.ts +++ b/src/user/getUserCompletedGames.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserCompletedGamesResponse, - UserCompletedGames + UserCompletedGames, } from "./models"; /** @@ -82,8 +82,8 @@ export const getUserCompletedGames = async ( "ConsoleID", "MaxPossible", "NumAwarded", - "PctWon" + "PctWon", ], - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/user/getUserCompletionProgress.test.ts b/src/user/getUserCompletionProgress.test.ts index 9b32bba..16efff0 100644 --- a/src/user/getUserCompletionProgress.test.ts +++ b/src/user/getUserCompletionProgress.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserCompletionProgress", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserCompletionProgressResponse = { @@ -41,9 +41,9 @@ describe("Function: getUserCompletionProgress", () => { NumAwardedHardcore: 8, MostRecentAwardedDate: "2022-07-26T23:56:15+00:00", HighestAwardKind: null, - HighestAwardDate: null - } - ] + HighestAwardDate: null, + }, + ], }; server.use( @@ -54,7 +54,7 @@ describe("Function: getUserCompletionProgress", () => { // ACT const response = await getUserCompletionProgress(authorization, { - userName: "xelnia" + userName: "xelnia", }); // ASSERT @@ -73,9 +73,9 @@ describe("Function: getUserCompletionProgress", () => { numAwardedHardcore: 8, mostRecentAwardedDate: "2022-07-26T23:56:15+00:00", highestAwardKind: null, - highestAwardDate: null - } - ] + highestAwardDate: null, + }, + ], }); }); }); diff --git a/src/user/getUserCompletionProgress.ts b/src/user/getUserCompletionProgress.ts index 9c3e1ed..3802051 100644 --- a/src/user/getUserCompletionProgress.ts +++ b/src/user/getUserCompletionProgress.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserCompletionProgressResponse, - UserCompletionProgress + UserCompletionProgress, } from "./models"; /** @@ -61,7 +61,7 @@ export const getUserCompletionProgress = async ( const { userName, offset, count } = payload; const params: Record = { - u: userName + u: userName, }; if (offset) { params["o"] = offset; diff --git a/src/user/getUserGameRankAndScore.test.ts b/src/user/getUserGameRankAndScore.test.ts index 1b84e2a..bfe4c48 100644 --- a/src/user/getUserGameRankAndScore.test.ts +++ b/src/user/getUserGameRankAndScore.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserGameRankAndScore", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserGameRankAndScoreResponse = [ @@ -31,8 +31,8 @@ describe("Function: getUserGameRankAndScore", () => { User: "xelnia", TotalScore: "1000", LastAward: "2022-09-01 21:51:23", - UserRank: "4" - } + UserRank: "4", + }, ]; server.use( @@ -44,7 +44,7 @@ describe("Function: getUserGameRankAndScore", () => { // ACT const response = await getUserGameRankAndScore(authorization, { userName: "xelnia", - gameId: 14_402 + gameId: 14_402, }); // ASSERT @@ -53,8 +53,8 @@ describe("Function: getUserGameRankAndScore", () => { user: "xelnia", totalScore: 1000, lastAward: "2022-09-01 21:51:23", - userRank: 4 - } + userRank: 4, + }, ]); }); }); diff --git a/src/user/getUserGameRankAndScore.ts b/src/user/getUserGameRankAndScore.ts index 3d23df7..1fab4f4 100644 --- a/src/user/getUserGameRankAndScore.ts +++ b/src/user/getUserGameRankAndScore.ts @@ -3,12 +3,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserGameRankAndScoreResponse, - UserGameRankAndScore + UserGameRankAndScore, } from "./models"; /** @@ -65,6 +65,6 @@ export const getUserGameRankAndScore = async ( const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldCastToNumbers: ["TotalScore", "UserRank"] + shouldCastToNumbers: ["TotalScore", "UserRank"], }); }; diff --git a/src/user/getUserPoints.test.ts b/src/user/getUserPoints.test.ts index ebfa93f..3718434 100644 --- a/src/user/getUserPoints.test.ts +++ b/src/user/getUserPoints.test.ts @@ -23,12 +23,12 @@ describe("Function: getUserPoints", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserPointsResponse = { Points: 10_000, - SoftcorePoints: 5400 + SoftcorePoints: 5400, }; server.use( @@ -43,7 +43,7 @@ describe("Function: getUserPoints", () => { // ASSERT expect(response).toEqual({ points: 10_000, - softcorePoints: 5400 + softcorePoints: 5400, }); }); }); diff --git a/src/user/getUserPoints.ts b/src/user/getUserPoints.ts index 4073f6d..d9f7725 100644 --- a/src/user/getUserPoints.ts +++ b/src/user/getUserPoints.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserPointsResponse, UserPoints } from "./models"; diff --git a/src/user/getUserProfile.test.ts b/src/user/getUserProfile.test.ts index 142b070..d52cc4a 100644 --- a/src/user/getUserProfile.test.ts +++ b/src/user/getUserProfile.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserProfile", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserProfileResponse = { @@ -42,7 +42,7 @@ describe("Function: getUserProfile", () => { Untracked: 0, ID: 16_446, UserWallActive: 1, - Motto: "Join me on Twitch! GameSquadSquad for live RA" + Motto: "Join me on Twitch! GameSquadSquad for live RA", }; server.use( @@ -53,7 +53,7 @@ describe("Function: getUserProfile", () => { // ACT const response = await getUserProfile(authorization, { - userName: "WCopeland" + userName: "WCopeland", }); // ASSERT @@ -73,7 +73,7 @@ describe("Function: getUserProfile", () => { untracked: false, id: 16_446, userWallActive: true, - motto: "Join me on Twitch! GameSquadSquad for live RA" + motto: "Join me on Twitch! GameSquadSquad for live RA", }); }); }); diff --git a/src/user/getUserProfile.ts b/src/user/getUserProfile.ts index 83a7470..a6879c2 100644 --- a/src/user/getUserProfile.ts +++ b/src/user/getUserProfile.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserProfileResponse, UserProfile } from "./models"; @@ -48,8 +48,8 @@ export const getUserProfile = async ( "TotalPoints", "TotalSoftcorePoints", "TotalTruePoints", - "Permissions" + "Permissions", ], - shouldMapToBooleans: ["Untracked", "UserWallActive"] + shouldMapToBooleans: ["Untracked", "UserWallActive"], }); }; diff --git a/src/user/getUserProgress.test.ts b/src/user/getUserProgress.test.ts index f03e19f..298a7e1 100644 --- a/src/user/getUserProgress.test.ts +++ b/src/user/getUserProgress.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserProgress", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserProgressResponse = { @@ -33,7 +33,7 @@ describe("Function: getUserProgress", () => { NumAchieved: "4", ScoreAchieved: "80", NumAchievedHardcore: "4", - ScoreAchievedHardcore: "80" + ScoreAchievedHardcore: "80", }, "14402": { NumPossibleAchievements: "10", @@ -41,8 +41,8 @@ describe("Function: getUserProgress", () => { NumAchieved: "4", ScoreAchieved: "80", NumAchievedHardcore: "4", - ScoreAchievedHardcore: "80" - } + ScoreAchievedHardcore: "80", + }, }; server.use( @@ -54,7 +54,7 @@ describe("Function: getUserProgress", () => { // ACT const response = await getUserProgress(authorization, { userName: "xelnia", - gameIds: [1, 14_402] + gameIds: [1, 14_402], }); // ASSERT @@ -65,7 +65,7 @@ describe("Function: getUserProgress", () => { numAchieved: 4, scoreAchieved: 80, numAchievedHardcore: 4, - scoreAchievedHardcore: 80 + scoreAchievedHardcore: 80, }, "14402": { numPossibleAchievements: 10, @@ -73,8 +73,8 @@ describe("Function: getUserProgress", () => { numAchieved: 4, scoreAchieved: 80, numAchievedHardcore: 4, - scoreAchievedHardcore: 80 - } + scoreAchievedHardcore: 80, + }, }); }); }); diff --git a/src/user/getUserProgress.ts b/src/user/getUserProgress.ts index 9384731..30a7b09 100644 --- a/src/user/getUserProgress.ts +++ b/src/user/getUserProgress.ts @@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserProgressResponse, UserProgress } from "./models"; @@ -73,7 +73,7 @@ export const getUserProgress = async ( "NumAchieved", "ScoreAchieved", "NumAchievedHardcore", - "ScoreAchievedHardcore" - ] + "ScoreAchievedHardcore", + ], }); }; diff --git a/src/user/getUserRecentAchievements.test.ts b/src/user/getUserRecentAchievements.test.ts index 2f94b5c..3352e94 100644 --- a/src/user/getUserRecentAchievements.test.ts +++ b/src/user/getUserRecentAchievements.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserRecentAchievements", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserRecentAchievementsResponse = [ @@ -42,8 +42,8 @@ describe("Function: getUserRecentAchievements", () => { GameID: 6316, ConsoleName: "Game Boy", BadgeURL: "/Badge/121991.png", - GameURL: "/game/6316" - } + GameURL: "/game/6316", + }, ]; server.use( @@ -54,7 +54,7 @@ describe("Function: getUserRecentAchievements", () => { // ACT const response = await getUserRecentAchievements(authorization, { - userName: "xelnia" + userName: "xelnia", }); // ASSERT @@ -74,8 +74,8 @@ describe("Function: getUserRecentAchievements", () => { gameId: 6316, consoleName: "Game Boy", badgeUrl: "/Badge/121991.png", - gameUrl: "/game/6316" - } + gameUrl: "/game/6316", + }, ]); }); }); diff --git a/src/user/getUserRecentAchievements.ts b/src/user/getUserRecentAchievements.ts index 66acc38..4738a42 100644 --- a/src/user/getUserRecentAchievements.ts +++ b/src/user/getUserRecentAchievements.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserRecentAchievementsResponse, - UserRecentAchievement + UserRecentAchievement, } from "./models"; /** @@ -75,6 +75,6 @@ export const getUserRecentAchievements = async ( const rawResponse = await call({ url }); return serializeProperties(rawResponse, { - shouldMapToBooleans: ["HardcoreMode"] + shouldMapToBooleans: ["HardcoreMode"], }); }; diff --git a/src/user/getUserRecentlyPlayedGames.test.ts b/src/user/getUserRecentlyPlayedGames.test.ts index 3a9f4d1..6cd9d2c 100644 --- a/src/user/getUserRecentlyPlayedGames.test.ts +++ b/src/user/getUserRecentlyPlayedGames.test.ts @@ -23,7 +23,7 @@ describe("Function: getUserRecentlyPlayedGames", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse: GetUserRecentlyPlayedGamesResponse = [ @@ -40,8 +40,8 @@ describe("Function: getUserRecentlyPlayedGames", () => { ScoreAchieved: 0, NumAchievedHardcore: 0, ScoreAchievedHardcore: 0, - MyVote: "2" - } + MyVote: "2", + }, ]; server.use( @@ -52,7 +52,7 @@ describe("Function: getUserRecentlyPlayedGames", () => { // ACT const response = await getUserRecentlyPlayedGames(authorization, { - userName: "xelnia" + userName: "xelnia", }); // ASSERT @@ -70,8 +70,8 @@ describe("Function: getUserRecentlyPlayedGames", () => { scoreAchieved: 0, numAchievedHardcore: 0, scoreAchievedHardcore: 0, - myVote: 2 - } + myVote: 2, + }, ]); }); }); diff --git a/src/user/getUserRecentlyPlayedGames.ts b/src/user/getUserRecentlyPlayedGames.ts index 0dd42d3..9784ee0 100644 --- a/src/user/getUserRecentlyPlayedGames.ts +++ b/src/user/getUserRecentlyPlayedGames.ts @@ -2,12 +2,12 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserRecentlyPlayedGamesResponse, - UserRecentlyPlayedGames + UserRecentlyPlayedGames, } from "./models"; /** @@ -88,7 +88,7 @@ export const getUserRecentlyPlayedGames = async ( "ScoreAchieved", "NumAchievedHardcore", "ScoreAchievedHardcore", - "MyVote" - ] + "MyVote", + ], }); }; diff --git a/src/user/getUserSummary.test.ts b/src/user/getUserSummary.test.ts index 04c2d04..fc7bb2f 100644 --- a/src/user/getUserSummary.test.ts +++ b/src/user/getUserSummary.test.ts @@ -25,7 +25,7 @@ describe("Function: getUserSummary", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse = mockGetUserSummaryResponse; @@ -38,7 +38,7 @@ describe("Function: getUserSummary", () => { // ACT const response = await getUserSummary(authorization, { - userName: "WCopeland" + userName: "WCopeland", }); // ASSERT @@ -49,7 +49,7 @@ describe("Function: getUserSummary", () => { // ARRANGE const authorization = buildAuthorization({ userName: "mockUserName", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); const mockResponse = "the api is down"; @@ -76,7 +76,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { ConsoleName: "PlayStation 2", Title: "Mortal Kombat: Deadly Alliance", ImageIcon: "/Images/064938.png", - LastPlayed: "2023-01-27 02:05:02" + LastPlayed: "2023-01-27 02:05:02", }, { GameID: "15922", @@ -84,8 +84,8 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { ConsoleName: "NES", Title: "~Hack~ Mega Man 3 Revamped", ImageIcon: "/Images/061792.png", - LastPlayed: "2022-11-07 21:49:09" - } + LastPlayed: "2022-11-07 21:49:09", + }, ], MemberSince: "2020-02-02 20:10:35", LastActivity: { @@ -95,7 +95,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { activitytype: "1", User: "WCopeland", data: "281263", - data2: "1" + data2: "1", }, RichPresenceMsg: "Arcade [Match 2] - Nitara vs Drahmin (Novice difficulty)", LastGameID: "19020", @@ -115,7 +115,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { Released: "November 16, 2002", IsFinal: false, ConsoleName: "PlayStation 2", - RichPresencePatch: "MockRichPresencePatch" + RichPresencePatch: "MockRichPresencePatch", }, ContribCount: "0", ContribYield: "0", @@ -135,7 +135,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { NumAchieved: "16", ScoreAchieved: "95", NumAchievedHardcore: "16", - ScoreAchievedHardcore: "95" + ScoreAchievedHardcore: "95", }, "6278": { NumPossibleAchievements: "42", @@ -143,8 +143,8 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { NumAchieved: 0, ScoreAchieved: 0, NumAchievedHardcore: 0, - ScoreAchievedHardcore: 0 - } + ScoreAchievedHardcore: 0, + }, }, RecentAchievements: { "19020": { @@ -158,15 +158,15 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = { BadgeName: "311063", IsAwarded: "1", DateAwarded: "2023-01-27 02:04:36", - HardcoreAchieved: "0" - } - } + HardcoreAchieved: "0", + }, + }, }, Points: "18817", SoftcorePoints: "25", UserPic: "/UserPic/WCopeland.png", TotalRanked: 34_572, - Status: "Offline" + Status: "Offline", }; const mockExpectedSummaryValue: UserSummary = { @@ -178,7 +178,7 @@ const mockExpectedSummaryValue: UserSummary = { consoleName: "PlayStation 2", title: "Mortal Kombat: Deadly Alliance", imageIcon: "/Images/064938.png", - lastPlayed: "2023-01-27 02:05:02" + lastPlayed: "2023-01-27 02:05:02", }, { gameId: 15_922, @@ -186,8 +186,8 @@ const mockExpectedSummaryValue: UserSummary = { consoleName: "NES", title: "~Hack~ Mega Man 3 Revamped", imageIcon: "/Images/061792.png", - lastPlayed: "2022-11-07 21:49:09" - } + lastPlayed: "2022-11-07 21:49:09", + }, ], memberSince: "2020-02-02 20:10:35", lastActivity: { @@ -197,7 +197,7 @@ const mockExpectedSummaryValue: UserSummary = { activitytype: 1, user: "WCopeland", data: "281263", - data2: "1" + data2: "1", }, richPresenceMsg: "Arcade [Match 2] - Nitara vs Drahmin (Novice difficulty)", lastGameId: 19_020, @@ -217,7 +217,7 @@ const mockExpectedSummaryValue: UserSummary = { released: "November 16, 2002", isFinal: false, consoleName: "PlayStation 2", - richPresencePatch: "MockRichPresencePatch" + richPresencePatch: "MockRichPresencePatch", }, contribCount: 0, contribYield: 0, @@ -237,7 +237,7 @@ const mockExpectedSummaryValue: UserSummary = { numAchieved: 16, scoreAchieved: 95, numAchievedHardcore: 16, - scoreAchievedHardcore: 95 + scoreAchievedHardcore: 95, }, "6278": { numPossibleAchievements: 42, @@ -245,8 +245,8 @@ const mockExpectedSummaryValue: UserSummary = { numAchieved: 0, scoreAchieved: 0, numAchievedHardcore: 0, - scoreAchievedHardcore: 0 - } + scoreAchievedHardcore: 0, + }, }, recentAchievements: { 19_020: { @@ -260,13 +260,13 @@ const mockExpectedSummaryValue: UserSummary = { badgeName: "311063", isAwarded: true, dateAwarded: "2023-01-27 02:04:36", - hardcoreAchieved: false - } - } + hardcoreAchieved: false, + }, + }, }, points: 18_817, softcorePoints: 25, userPic: "/UserPic/WCopeland.png", totalRanked: 34_572, - status: "Offline" + status: "Offline", }; diff --git a/src/user/getUserSummary.ts b/src/user/getUserSummary.ts index 3ac328a..d5916de 100644 --- a/src/user/getUserSummary.ts +++ b/src/user/getUserSummary.ts @@ -2,7 +2,7 @@ import { apiBaseUrl, buildRequestUrl, call, - serializeProperties + serializeProperties, } from "../utils/internal"; import type { AuthObject } from "../utils/public"; import type { GetUserSummaryResponse, UserSummary } from "./models"; @@ -82,13 +82,13 @@ export const getUserSummary = async ( "NumAchievedHardcore", "ScoreAchievedHardcore", "Points", - "SoftcorePoints" + "SoftcorePoints", ], shouldMapToBooleans: [ "Untracked", "UserWallActive", "IsAwarded", - "HardcoreAchieved" - ] + "HardcoreAchieved", + ], }); }; diff --git a/src/user/models/game-info-and-user-progress.model.ts b/src/user/models/game-info-and-user-progress.model.ts index 21ff0d3..4842631 100644 --- a/src/user/models/game-info-and-user-progress.model.ts +++ b/src/user/models/game-info-and-user-progress.model.ts @@ -1,6 +1,6 @@ import type { GameExtended, - GameExtendedAchievementEntity + GameExtendedAchievementEntity, } from "../../game/models"; export type GameExtendedAchievementEntityWithUserProgress = diff --git a/src/user/models/get-game-info-and-user-progress-response.model.ts b/src/user/models/get-game-info-and-user-progress-response.model.ts index a9299f7..2f05fdc 100644 --- a/src/user/models/get-game-info-and-user-progress-response.model.ts +++ b/src/user/models/get-game-info-and-user-progress-response.model.ts @@ -1,6 +1,6 @@ import type { GameExtendedRawAchievementEntity, - GetGameExtendedResponse + GetGameExtendedResponse, } from "../../game/models"; type GetGameExtendedResponseWithoutClaims = Omit< diff --git a/src/utils/internal/buildRequestUrl.test.ts b/src/utils/internal/buildRequestUrl.test.ts index cd9841e..e6e7511 100644 --- a/src/utils/internal/buildRequestUrl.test.ts +++ b/src/utils/internal/buildRequestUrl.test.ts @@ -15,7 +15,7 @@ describe("Util: buildRequestUrl", () => { baz: "myBazValue", limit: 10, offset: 2, - notDefined: undefined + notDefined: undefined, }; // ACT @@ -40,7 +40,7 @@ describe("Util: buildRequestUrl", () => { // ACT const requestUrl = buildRequestUrl(baseUrl, endpointUrl, { userName: "TestUser", - webApiKey: "mockWebApiKey" + webApiKey: "mockWebApiKey", }); // ASSERT diff --git a/src/utils/internal/buildRequestUrl.ts b/src/utils/internal/buildRequestUrl.ts index 65eb97c..a8eed9e 100644 --- a/src/utils/internal/buildRequestUrl.ts +++ b/src/utils/internal/buildRequestUrl.ts @@ -15,7 +15,7 @@ export const buildRequestUrl = ( // Authentication is handled purely by query params. const queryParamValues: Record = { z: authObject.userName, - y: authObject.webApiKey + y: authObject.webApiKey, }; for (const [argKey, argValue] of Object.entries(args)) { diff --git a/src/utils/internal/call.test.ts b/src/utils/internal/call.test.ts index 4ff5d85..8ddacdb 100644 --- a/src/utils/internal/call.test.ts +++ b/src/utils/internal/call.test.ts @@ -44,7 +44,7 @@ describe("Util: call", () => { server.use( http.get(mockRequestUrl, () => HttpResponse.text("something bad happened", { - status: 503 + status: 503, }) ) ); diff --git a/src/utils/internal/call.ts b/src/utils/internal/call.ts index 6f85f42..64cc589 100644 --- a/src/utils/internal/call.ts +++ b/src/utils/internal/call.ts @@ -16,7 +16,7 @@ export const call = async < const { url } = config; const headers = new Headers({ - "User-Agent": `RetroAchievements-api-js/${packageVersion}` + "User-Agent": `RetroAchievements-api-js/${packageVersion}`, }); const rawResponse = await fetch(url, { headers }); diff --git a/src/utils/internal/serializeProperties.test.ts b/src/utils/internal/serializeProperties.test.ts index d558439..71652b6 100644 --- a/src/utils/internal/serializeProperties.test.ts +++ b/src/utils/internal/serializeProperties.test.ts @@ -15,7 +15,7 @@ describe("Util: serializeProperties", () => { GameID: 100, AchievementIDs: [1, 2, 3, 4, 5], RAPoints: 100, - ConsoleName: "PlayStation Portable" + ConsoleName: "PlayStation Portable", }; // ACT @@ -27,7 +27,7 @@ describe("Util: serializeProperties", () => { gameId: 100, achievementIds: [1, 2, 3, 4, 5], raPoints: 100, - consoleName: "PlayStation Portable" + consoleName: "PlayStation Portable", }); }); @@ -39,8 +39,8 @@ describe("Util: serializeProperties", () => { GameID: 100, AchievementIDs: [1, 2, 3, 4, 5], RAPoints: 100, - ConsoleName: "PlayStation Portable" - } + ConsoleName: "PlayStation Portable", + }, ]; // ACT @@ -53,8 +53,8 @@ describe("Util: serializeProperties", () => { gameId: 100, achievementIds: [1, 2, 3, 4, 5], raPoints: 100, - consoleName: "PlayStation Portable" - } + consoleName: "PlayStation Portable", + }, ]); }); @@ -68,8 +68,8 @@ describe("Util: serializeProperties", () => { ConsoleName: "PlayStation Portable", UserMeta: { Name: "xelnia", - Points: 100 - } + Points: 100, + }, }; // ACT @@ -84,8 +84,8 @@ describe("Util: serializeProperties", () => { consoleName: "PlayStation Portable", userMeta: { name: "xelnia", - points: 100 - } + points: 100, + }, }); }); @@ -95,13 +95,13 @@ describe("Util: serializeProperties", () => { UserName: "xelnia", Points: "500", Metadata: { - TitleID: "100" - } + TitleID: "100", + }, }; // ACT const sanitizedObject = serializeProperties(originalObject, { - shouldCastToNumbers: ["TitleID", "Points"] + shouldCastToNumbers: ["TitleID", "Points"], }); // ASSERT @@ -109,8 +109,8 @@ describe("Util: serializeProperties", () => { userName: "xelnia", points: 500, metadata: { - titleId: 100 - } + titleId: 100, + }, }); }); @@ -120,13 +120,13 @@ describe("Util: serializeProperties", () => { UserName: "xelnia", HardcoreMode: "0", Metadata: { - IsCoolGuy: "1" - } + IsCoolGuy: "1", + }, }; // ACT const sanitizedObject = serializeProperties(originalObject, { - shouldMapToBooleans: ["HardcoreMode", "IsCoolGuy"] + shouldMapToBooleans: ["HardcoreMode", "IsCoolGuy"], }); // ASSERT @@ -134,8 +134,8 @@ describe("Util: serializeProperties", () => { userName: "xelnia", hardcoreMode: false, metadata: { - isCoolGuy: true - } + isCoolGuy: true, + }, }); }); }); diff --git a/src/utils/internal/serializeProperties.ts b/src/utils/internal/serializeProperties.ts index f8c02c8..c474fd2 100644 --- a/src/utils/internal/serializeProperties.ts +++ b/src/utils/internal/serializeProperties.ts @@ -42,7 +42,7 @@ export const serializeProperties = ( [naiveCamelCase(originalKey)]: serializeProperties( sanitizedValue, options - ) + ), }; } diff --git a/src/utils/public/buildAuthorization.test.ts b/src/utils/public/buildAuthorization.test.ts index 101a068..b3638fa 100644 --- a/src/utils/public/buildAuthorization.test.ts +++ b/src/utils/public/buildAuthorization.test.ts @@ -10,7 +10,7 @@ describe("Util: buildAuthorization", () => { // ARRANGE const myAuth = { userName: "myUserName", - webApiKey: "myWebApiKey" + webApiKey: "myWebApiKey", }; // ACT diff --git a/vitest.config.ts b/vitest.config.ts index 41548b8..38c485a 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -13,7 +13,7 @@ export default defineConfig({ ".next", ".docusaurus", "cypress", - "**/node_modules/**" + "**/node_modules/**", ], coverage: { @@ -23,12 +23,12 @@ export default defineConfig({ "**/*.enum.ts", "**/index.ts", "**/test/**", - "**/__playground.ts" + "**/__playground.ts", ], statements: 95, branches: 80, functions: 100, - lines: 95 - } - } + lines: 95, + }, + }, });