2024-04-15 07:56:26 +00:00
|
|
|
import { getBlockedStatus, getServer, getServerIcon } from "../dist";
|
2024-04-14 20:11:46 +00:00
|
|
|
import { ServerPlatform } from "../src/types/server/platform";
|
|
|
|
|
|
|
|
test("ensureGetServerLookupSuccess", async () => {
|
2024-04-15 07:56:26 +00:00
|
|
|
const cachedServer = await getServer(ServerPlatform.Java, "mc.hypixel.net");
|
2024-04-14 20:11:46 +00:00
|
|
|
const { server } = cachedServer;
|
|
|
|
|
|
|
|
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-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
|
|
|
});
|