forked from phenom/healer-man
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import {
|
|
ensureRandomizedBiteSizedRunContent,
|
|
randomizedBiteSizedModelUrls,
|
|
} from "./randomizedBiteSizedContent";
|
|
import { RANDOMIZED_BITE_SIZED_AVAILABLE_DUNGEON_ID } from "../game/dungeonContentSource";
|
|
|
|
describe("randomized bite-sized run content", () => {
|
|
it("derives only the distinct model URLs selected by the shared run seed", () => {
|
|
const first = randomizedBiteSizedModelUrls("asset-seed");
|
|
const second = randomizedBiteSizedModelUrls("asset-seed");
|
|
expect(first).toEqual(second);
|
|
expect(first.length).toBeGreaterThan(1);
|
|
expect(new Set(first).size).toBe(first.length);
|
|
expect(first.every((url) => url.startsWith("/assets/") && url.endsWith(".glb"))).toBe(true);
|
|
});
|
|
|
|
it("prepares the selected Bite-Sized source pool for the same shared seed", () => {
|
|
const urls = randomizedBiteSizedModelUrls("asset-seed", RANDOMIZED_BITE_SIZED_AVAILABLE_DUNGEON_ID);
|
|
expect(urls).toEqual(randomizedBiteSizedModelUrls("asset-seed", RANDOMIZED_BITE_SIZED_AVAILABLE_DUNGEON_ID));
|
|
expect(urls.length).toBeGreaterThan(1);
|
|
expect(new Set(urls).size).toBe(urls.length);
|
|
});
|
|
|
|
it("installs the base location and only the rolled creature model packs before entry", async () => {
|
|
const installPack = vi.fn(async () => undefined);
|
|
const installUrls = vi.fn(async () => undefined);
|
|
await ensureRandomizedBiteSizedRunContent("download-seed", {
|
|
development: false,
|
|
installPack,
|
|
installUrls,
|
|
packIsUsable: () => false,
|
|
packHasUpdate: () => false,
|
|
});
|
|
|
|
expect(installPack).toHaveBeenCalledWith("activity:randomized-bite-sized");
|
|
expect(installUrls).toHaveBeenCalledWith(randomizedBiteSizedModelUrls("download-seed"));
|
|
expect(installPack.mock.invocationCallOrder[0]).toBeLessThan(installUrls.mock.invocationCallOrder[0]);
|
|
});
|
|
|
|
it("skips network installation in the unrestricted development asset server", async () => {
|
|
const installPack = vi.fn(async () => undefined);
|
|
const installUrls = vi.fn(async () => undefined);
|
|
await ensureRandomizedBiteSizedRunContent("dev-seed", {
|
|
development: true,
|
|
installPack,
|
|
installUrls,
|
|
packIsUsable: () => false,
|
|
packHasUpdate: () => false,
|
|
});
|
|
expect(installPack).not.toHaveBeenCalled();
|
|
expect(installUrls).not.toHaveBeenCalled();
|
|
});
|
|
});
|