Skip to content

Commit 7d2a480

Browse files
committed
fix(casing): Unknown -> UNKNOWN
1 parent 2fea995 commit 7d2a480

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/Private/RequestHandler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ test('RequestHandler (400 Bad Request No Cause)', async () => {
6767
json: () => Promise.resolve({ success: false })
6868
} as any);
6969
await expect(() => client.requestHandler.request('/boosters')).rejects.toThrowError(
70-
Errors.ERROR_CODE_CAUSE.replace(/{code}/, '400 Bad Request').replace(/{cause}/, 'Unknown')
70+
Errors.ERROR_CODE_CAUSE.replace(/{code}/, '400 Bad Request').replace(/{cause}/, 'UNKNOWN')
7171
);
7272
vi.restoreAllMocks();
7373
client.destroy();

src/Private/RequestHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class RequestHandler {
4343
const parsedRes = (await res.json()) as Record<string, any>;
4444
if (res.status === 400) {
4545
throw new Error(
46-
Errors.ERROR_CODE_CAUSE.replace(/{code}/, '400 Bad Request').replace(/{cause}/, parsedRes.cause || 'Unknown')
46+
Errors.ERROR_CODE_CAUSE.replace(/{code}/, '400 Bad Request').replace(/{cause}/, parsedRes.cause || 'UNKNOWN')
4747
);
4848
}
4949
if (res.status === 403) throw new Error(Errors.INVALID_API_KEY);

src/Structures/GameCounts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class GameCounts {
99
this.playerCount = data.playerCount;
1010
for (const game in data.games) {
1111
if (Object.prototype.hasOwnProperty.call(MiniGamesString, game)) {
12-
const objectName = (MiniGamesString[game] || 'Unknown').toUpperCase().replace(/ +/g, '_');
12+
const objectName = (MiniGamesString[game] || 'UNKNOWN').toUpperCase().replace(/ +/g, '_');
1313
this[RemoveSnakeCaseString(objectName)] = recursive(data.games[game], true);
1414
} else {
1515
this[RemoveSnakeCaseString(game)] = recursive(data.games[game], true);

src/Structures/Guild/Guild.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class Guild {
3030
preferredGames: Game[];
3131
constructor(data: Record<string, any>, uuid?: string) {
3232
// eslint-disable-next-line no-underscore-dangle
33-
this.id = data._id || 'Unknown';
34-
this.name = data.name || 'Unknown';
33+
this.id = data._id || 'UNKNOWN';
34+
this.name = data.name || 'UNKNOWN';
3535
this.description = data.description ?? '';
3636
this.experience = data.exp || 0;
3737
this.level = getGuildLevel(this.experience);

src/Structures/Player/PlayerAchievements/PlayerAchievementsRewards.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class PlayerAchievementsRewards {
1010
return parseInt(keyA) - parseInt(keyB);
1111
})
1212
.forEach((item) => {
13-
const key: string = Object.keys(item)?.[0] || 'Unknown';
13+
const key: string = Object.keys(item)?.[0] || 'UNKNOWN';
1414
this[key] = item[key];
1515
});
1616
}

src/Utils/Guild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function calculateExpHistory(data: GuildMember[]): ExpHistory[] {
6767
Object.keys(data[0].expHistory).forEach((day, index) => {
6868
let GEXP = 0;
6969
data.forEach((member) => (GEXP += member.expHistory?.[index]?.exp || 0));
70-
finalObj[data[0]?.expHistory[index]?.day || 'Unknown'] = expLimit(GEXP);
70+
finalObj[data[0]?.expHistory[index]?.day || 'UNKNOWN'] = expLimit(GEXP);
7171
});
7272
return parseHistory(finalObj);
7373
}

src/Utils/RemoveSnakeCase.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function recursive(obj: any, lowerCase: boolean = false): any {
77
return Object.keys(obj).reduce(
88
(pV, cV) => ({
99
...pV,
10-
[(lowerCase ? cV : cV.toLowerCase()).replace(/_[a-z]/gi, (x) => (x?.[1] || 'Unknown').toUpperCase())]: recursive(
10+
[(lowerCase ? cV : cV.toLowerCase()).replace(/_[a-z]/gi, (x) => (x?.[1] || 'UNKNOWN').toUpperCase())]: recursive(
1111
obj[cV]
1212
)
1313
}),
@@ -16,5 +16,5 @@ export function recursive(obj: any, lowerCase: boolean = false): any {
1616
}
1717

1818
export function RemoveSnakeCaseString(str: string): string {
19-
return str.toLowerCase().replace(/_[a-z]/gi, (x) => (x?.[1] || 'Unknown').toUpperCase());
19+
return str.toLowerCase().replace(/_[a-z]/gi, (x) => (x?.[1] || 'UNKNOWN').toUpperCase());
2020
}

0 commit comments

Comments
 (0)