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

33 lines
933 B
TypeScript

import { getPlayer, getPlayerSkinPart, getPlayerUuid } from "../dist/index";
test("ensureGetPlayerLookupSuccess", async () => {
const response = await getPlayer("Notch");
const { player } = response;
expect(player).toBeDefined();
expect(player).toHaveProperty("username");
});
test("ensureGetPlayerUuidSuccess", async () => {
const player = await getPlayerUuid("Notch");
expect(player).toBeDefined();
expect(player).toHaveProperty("username");
expect(player).toHaveProperty("uniqueId");
});
test("ensureGetPlayerSkinPartSuccess", async () => {
const response = await getPlayer("Notch");
const { player } = response;
const skin = player.skin;
const skinParts = skin.parts;
// Test each skin part
for (const part in skinParts) {
const partBuffer = await getPlayerSkinPart(part, player.uniqueId);
expect(partBuffer).toBeDefined();
expect(partBuffer.byteLength).toBeGreaterThan(0);
}
});