Javascript-Library/test/server.ts
2024-04-14 21:11:46 +01:00

22 lines
821 B
TypeScript

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
});