Javascript-Library/test/server.ts
2024-04-20 22:49:53 +01:00

29 lines
1.0 KiB
TypeScript

import {getBlockedStatus, getServer, getServerIcon, getServerPreview, ServerPlatform} from "../dist";
test("ensureGetServerLookupSuccess", async () => {
const server = await getServer(ServerPlatform.Java, "mc.hypixel.net");
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
});
test("ensureGetServerPreviewSuccess", async () => {
const preview = await getServerPreview(ServerPlatform.Java, "mc.hypixel.net");
expect(preview).toBeDefined();
expect(preview.byteLength).toBeGreaterThan(0); // The server has a preview
});