Javascript-Library/test/player.ts

32 lines
866 B
TypeScript
Raw Normal View History

2024-04-19 19:39:30 +00:00
import {getPlayer, getPlayerSkinPart, getPlayerUuid} from "../dist/index";
2024-04-14 20:11:46 +00:00
test("ensureGetPlayerLookupSuccess", async () => {
2024-04-17 15:38:49 +00:00
const player = await getPlayer("Notch");
2024-04-14 20:11:46 +00:00
expect(player).toBeDefined();
expect(player).toHaveProperty("username");
});
test("ensureGetPlayerUuidSuccess", async () => {
2024-04-15 07:56:26 +00:00
const player = await getPlayerUuid("Notch");
2024-04-14 20:11:46 +00:00
expect(player).toBeDefined();
expect(player).toHaveProperty("username");
expect(player).toHaveProperty("uniqueId");
});
test("ensureGetPlayerSkinPartSuccess", async () => {
2024-04-17 15:38:49 +00:00
const player = await getPlayer("Notch");
2024-04-14 20:11:46 +00:00
const skin = player.skin;
const skinParts = skin.parts;
// Test each skin part
for (const part in skinParts) {
2024-04-15 07:56:26 +00:00
const partBuffer = await getPlayerSkinPart(part, player.uniqueId);
2024-04-20 21:49:53 +00:00
2024-04-14 20:11:46 +00:00
expect(partBuffer).toBeDefined();
expect(partBuffer.byteLength).toBeGreaterThan(0);
}
});