initital commit
This commit is contained in:
7
test/mojang.ts
Normal file
7
test/mojang.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import mcUtils from "../src/index";
|
||||
|
||||
test("ensureMojangEndpointStatusLookupSuccess", async () => {
|
||||
const response = await mcUtils.mojang.getMojangEndpointStatus();
|
||||
|
||||
expect(response).toHaveProperty("endpoints");
|
||||
});
|
32
test/player.ts
Normal file
32
test/player.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import mcUtils from "../src/index";
|
||||
|
||||
test("ensureGetPlayerLookupSuccess", async () => {
|
||||
const response = await mcUtils.player.getPlayer("Notch");
|
||||
const { player } = response;
|
||||
|
||||
expect(player).toBeDefined();
|
||||
expect(player).toHaveProperty("username");
|
||||
});
|
||||
|
||||
test("ensureGetPlayerUuidSuccess", async () => {
|
||||
const player = await mcUtils.player.getPlayerUuid("Notch");
|
||||
|
||||
expect(player).toBeDefined();
|
||||
expect(player).toHaveProperty("username");
|
||||
expect(player).toHaveProperty("uniqueId");
|
||||
});
|
||||
|
||||
test("ensureGetPlayerSkinPartSuccess", async () => {
|
||||
const response = await mcUtils.player.getPlayer("Notch");
|
||||
const { player } = response;
|
||||
|
||||
const skin = player.skin;
|
||||
const skinParts = skin.parts;
|
||||
|
||||
// Test each skin part
|
||||
for (const part in skinParts) {
|
||||
const partBuffer = await mcUtils.player.getPlayerSkinPart(part, player.uniqueId);
|
||||
expect(partBuffer).toBeDefined();
|
||||
expect(partBuffer.byteLength).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
21
test/server.ts
Normal file
21
test/server.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import mcUtils from "../src/index";
|
||||
import { ServerPlatform } from "../src/types/server/platform";
|
||||
|
||||
test("ensureGetServerLookupSuccess", async () => {
|
||||
const cachedServer = await mcUtils.server.getServer(ServerPlatform.Java, "mc.hypixel.net");
|
||||
const { server } = cachedServer;
|
||||
|
||||
expect(server).toBeDefined();
|
||||
expect(server).toHaveProperty("hostname"); // The server was found
|
||||
});
|
||||
|
||||
test("ensureGetServerIconSuccess", async () => {
|
||||
const icon = await mcUtils.server.getServerIcon("mc.hypixel.net");
|
||||
expect(icon).toBeDefined();
|
||||
expect(icon.byteLength).toBeGreaterThan(0); // The server has an icon
|
||||
});
|
||||
|
||||
test("ensureGetServerBlockedStatusSuccess", async () => {
|
||||
const blockedStatus = await mcUtils.server.getBlockedStatus("mc.hypixel.net");
|
||||
expect(blockedStatus).toBe(false); // The server is not blocked
|
||||
});
|
Reference in New Issue
Block a user