Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
ci/cd testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Aug 21, 2024
1 parent bab8921 commit 53d1c5f
Show file tree
Hide file tree
Showing 33 changed files with 100 additions and 98 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,6 @@ jobs:
run: pnpm i

- name: Check tests
env:
HYPIXEL_KEY: ${{ secrets.HYPIXEL_KEY }}
run: pnpm test
4 changes: 2 additions & 2 deletions src/API/getAchievements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { StaticGameNames } from '../typings';
import Client from '../Client';

test('getAchievements (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getAchievements({ raw: true });
Expand All @@ -17,7 +17,7 @@ test('getAchievements (raw)', async () => {
});

test('getAchievements', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getAchievements();
Expand Down
4 changes: 2 additions & 2 deletions src/API/getActiveHouses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import House from '../structures/House';
import Client from '../Client';

test('getActiveHouses (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getActiveHouses({ raw: true });
Expand All @@ -13,7 +13,7 @@ test('getActiveHouses (raw)', async () => {
});

test('getActiveHouses', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getActiveHouses();
Expand Down
4 changes: 2 additions & 2 deletions src/API/getBoosters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Game from '../structures/Game';
import Client from '../Client';

test('getBoosters (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getBoosters({ raw: true });
Expand All @@ -14,7 +14,7 @@ test('getBoosters (raw)', async () => {
});

test('getBoosters', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getBoosters();
Expand Down
4 changes: 2 additions & 2 deletions src/API/getChallenges.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StaticGameNames } from '../typings';
import Client from '../Client';

test('getChallenges (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getChallenges({ raw: true });
Expand All @@ -15,7 +15,7 @@ test('getChallenges (raw)', async () => {
});

test('getChallenges', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getChallenges();
Expand Down
4 changes: 2 additions & 2 deletions src/API/getGameCounts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import GameCounts from '../structures/GameCounts';
import Client from '../Client';

test('getGameCounts (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGameCounts({ raw: true });
Expand All @@ -13,7 +13,7 @@ test('getGameCounts (raw)', async () => {
});

test('getGameCounts', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGameCounts();
Expand Down
18 changes: 9 additions & 9 deletions src/API/getGuild.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,39 @@ import Errors from '../Errors';
const errors = new Errors();

test('Invalid Guild Type', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getGuild('invalid', 'invalid')).rejects.toThrowError(errors.INVALID_GUILD_SEARCH_PARAMETER);
client.destroy();
});

test('Invalid Guild', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getGuild('name', 'this guild dose not exist')).rejects.toThrowError(errors.GUILD_DOES_NOT_EXIST);
client.destroy();
});

test('Invalid Guild ID', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getGuild('id', 'invalid guild id')).rejects.toThrowError(errors.INVALID_GUILD_ID);
client.destroy();
});

test('No Guild Query', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getGuild('id')).rejects.toThrowError(errors.NO_GUILD_QUERY);
client.destroy();
});

test('User not in a guild', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuild('player', '37501e7512b845ab8796e2baf9e9677a');
Expand All @@ -53,7 +53,7 @@ test('User not in a guild', async () => {
});

test('getGuild (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuild('name', 'Pixelic', { raw: true });
Expand All @@ -63,7 +63,7 @@ test('getGuild (raw)', async () => {
});

test('getGuild (Name)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuild('name', 'Pixelic');
Expand Down Expand Up @@ -201,7 +201,7 @@ test('getGuild (Name)', async () => {
});

test('getGuild (Id)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuild('id', '64b54f9d8ea8c96aaedafe84');
Expand Down Expand Up @@ -339,7 +339,7 @@ test('getGuild (Id)', async () => {
});

test('getGuild (Player)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuild('player', '14727faefbdc4aff848cd2713eb9939e');
Expand Down
4 changes: 2 additions & 2 deletions src/API/getGuildAchievements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { expect, expectTypeOf, test } from 'vitest';
import Client from '../Client';

test('getGuildAchievements (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuildAchievements({ raw: true });
Expand All @@ -15,7 +15,7 @@ test('getGuildAchievements (raw)', async () => {
});

test('getGuildAchievements', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getGuildAchievements();
Expand Down
6 changes: 3 additions & 3 deletions src/API/getHouse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Errors from '../Errors';
const errors = new Errors();

test('getHouse (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const houses = await client.getActiveHouses();
Expand All @@ -18,15 +18,15 @@ test('getHouse (raw)', async () => {
});

test('getHouse (no input)', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getHouse()).rejects.toThrowError(errors.NO_UUID);
client.destroy();
});

test('getHouse', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const houses = await client.getActiveHouses();
Expand Down
4 changes: 2 additions & 2 deletions src/API/getLeaderboards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Leaderboard from '../structures/Leaderboard';
import Client from '../Client';

test('getLeaderboards (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getLeaderboards({ raw: true });
Expand All @@ -13,7 +13,7 @@ test('getLeaderboards (raw)', async () => {
});

test('getLeaderboards', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getLeaderboards();
Expand Down
12 changes: 6 additions & 6 deletions src/API/getPlayer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ import RecentGame from '../structures/RecentGame';
const errors = new Errors();

test('No Player Input', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getPlayer()).rejects.toThrowError(errors.NO_NICKNAME_UUID);
client.destroy();
});

test('getPLayer (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { raw: true });
Expand All @@ -53,7 +53,7 @@ test('getPLayer (raw)', async () => {
});

test('getPlayer (guild)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { guild: true });
Expand All @@ -66,7 +66,7 @@ test('getPlayer (guild)', async () => {
});

test('getPlayer (houses)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { houses: true });
Expand All @@ -83,7 +83,7 @@ test('getPlayer (houses)', async () => {
});

test('getPlayer (recent games)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e', { recentGames: true });
Expand All @@ -100,7 +100,7 @@ test('getPlayer (recent games)', async () => {
});

test('getPlayer', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayer('14727faefbdc4aff848cd2713eb9939e');
Expand Down
6 changes: 3 additions & 3 deletions src/API/getPlayerHouses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import Errors from '../Errors';
const errors = new Errors();

test('getPlayerHouses (No input)', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getPlayerHouses()).rejects.toThrowError(errors.NO_NICKNAME_UUID);
client.destroy();
});

test('getPlayerHouses (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayerHouses('69e04609da2a4e7dabb83546a971969e', { raw: true });
Expand All @@ -23,7 +23,7 @@ test('getPlayerHouses (raw)', async () => {
});

test('getPlayerHouses', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getPlayerHouses('69e04609da2a4e7dabb83546a971969e');
Expand Down
4 changes: 2 additions & 2 deletions src/API/getQuests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { StaticGameNames } from '../typings';
import Client from '../Client';

test('getQuests (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getQuests({ raw: true });
Expand All @@ -16,7 +16,7 @@ test('getQuests (raw)', async () => {
});

test('getQuests', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getQuests();
Expand Down
6 changes: 3 additions & 3 deletions src/API/getRecentGames.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import Errors from '../Errors';
const errors = new Errors();

test('getRecentGames (no input)', () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getRecentGames()).rejects.toThrowError(errors.NO_NICKNAME_UUID);
client.destroy();
});

test('getRecentGames (raw)', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getRecentGames('14727faefbdc4aff848cd2713eb9939e', { raw: true });
Expand All @@ -23,7 +23,7 @@ test('getRecentGames (raw)', async () => {
});

test('getRecentGames', async () => {
const client = new Client(process.env.key ?? '', { cache: false, checkForUpdates: false });
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getRecentGames('14727faefbdc4aff848cd2713eb9939e');
Expand Down
Loading

0 comments on commit 53d1c5f

Please sign in to comment.