Javascript-Library/test/server.ts
Liam b9d79659c8
Some checks failed
Publish Package / build (push) Has been cancelled
cleanup
2024-04-15 08:56:26 +01:00

24 lines
842 B
TypeScript

import { getBlockedStatus, getServer, getServerIcon } from "../dist";
import { ServerPlatform } from "../src/types/server/platform";
test("ensureGetServerLookupSuccess", async () => {
const cachedServer = await 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 getServerIcon("mc.hypixel.net");
expect(icon).toBeDefined();
expect(icon.byteLength).toBeGreaterThan(0); // The server has an icon
});
test("ensureGetServerBlockedStatusSuccess", async () => {
const blockedStatus = await getBlockedStatus("mc.hypixel.net");
const { blocked } = blockedStatus;
expect(blocked).toBe(false); // The server is not blocked
});