Javascript-Library/test/server.ts

29 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-04-20 21:49:53 +00:00
import {getBlockedStatus, getServer, getServerIcon, getServerPreview, ServerPlatform} from "../dist";
2024-04-14 20:11:46 +00:00
test("ensureGetServerLookupSuccess", async () => {
2024-04-17 15:40:02 +00:00
const server = await getServer(ServerPlatform.Java, "mc.hypixel.net");
2024-04-14 20:11:46 +00:00
expect(server).toBeDefined();
expect(server).toHaveProperty("hostname"); // The server was found
});
test("ensureGetServerIconSuccess", async () => {
2024-04-15 07:56:26 +00:00
const icon = await getServerIcon("mc.hypixel.net");
2024-04-20 21:49:53 +00:00
2024-04-14 20:11:46 +00:00
expect(icon).toBeDefined();
expect(icon.byteLength).toBeGreaterThan(0); // The server has an icon
});
test("ensureGetServerBlockedStatusSuccess", async () => {
2024-04-15 07:56:26 +00:00
const blockedStatus = await getBlockedStatus("mc.hypixel.net");
const { blocked } = blockedStatus;
expect(blocked).toBe(false); // The server is not blocked
2024-04-14 20:11:46 +00:00
});
2024-04-20 21:49:53 +00:00
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
});