Skip to content

armgit / fuobe

Public Imported from GitHub
0

The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.

Tests: steady on a busy machine and on Node 22

Adarsh1efff80f0f7e
diff --git a/tests/hosted-guest-draft.test.ts b/tests/hosted-guest-draft.test.ts
index af46b309..7879fc91 100644
--- a/tests/hosted-guest-draft.test.ts
+++ b/tests/hosted-guest-draft.test.ts
@@ -32,7 +32,10 @@ win.addEventListener("fuobe:guest-prompt", (e) => events.push(`guest:${(e as Cus
vi.stubGlobal("window", win);
// Node before 24 has no Web Locks API (navigator.locks): a stand-in with what browsers do for the calls held-files makes
// (exclusive locks held while the callback's promise runs, ifAvailable, query).
-if (!globalThis.navigator?.locks) {
+const withLocks = !globalThis.navigator?.locks ? standInLocks() : null;
+if (withLocks) vi.stubGlobal("navigator", withLocks);
+
+function standInLocks(): Navigator {
const taken = new Set<string>();
const locks = {
async request(name: string, a: unknown, b?: unknown) {
@@ -53,7 +56,7 @@ if (!globalThis.navigator?.locks) {
return { held: [...taken].map((name) => ({ name, mode: "exclusive" })), pending: [] };
},
};
- vi.stubGlobal("navigator", Object.create(globalThis.navigator ?? null, { locks: { value: locks } }));
+ return Object.create(globalThis.navigator ?? null, { locks: { value: locks } }) as Navigator;
}
const draftLib = await import("@/lib/guest-draft");
@@ -274,6 +277,7 @@ describe("a guest's files, kept in this browser", () => {
vi.unstubAllGlobals();
vi.stubGlobal("sessionStorage", storage);
vi.stubGlobal("window", win);
+ if (withLocks) vi.stubGlobal("navigator", withLocks);
});
it("each studio's draft forgets only the files it held itself: one taken out of a draft never takes another studio's", () => {
diff --git a/tests/motion-marketing.test.ts b/tests/motion-marketing.test.ts
index 3e48a790..350dd35c 100644
--- a/tests/motion-marketing.test.ts
+++ b/tests/motion-marketing.test.ts
@@ -145,7 +145,7 @@ describe("spelling", () => {
}
}
}
- });
+ }, 60_000);
it("never draws the stars that mark the headline's words", () => {
const s = scenes.find((x) => x.id === "marketing/kinetic-headline")!;
diff --git a/tests/nav-search.test.ts b/tests/nav-search.test.ts
index 5089e785..e4219fe9 100644
--- a/tests/nav-search.test.ts
+++ b/tests/nav-search.test.ts
@@ -213,11 +213,11 @@ describe("search speed", () => {
big.length = 1500;
const queries = ["ad for my perfume", "talking photo", "4k", "remove background", "cinma", "tiktok dance", "zoom", "video tools", "youtube channel", "x"];
searchNav("warm up", big);
- // The best of three rounds of 100: other test files share the CPU.
- const rounds = [0, 1, 2].map(() => {
+ // The best of ten rounds of 50: other test files (and programs) share the CPU, so one quiet round is what counts.
+ const rounds = Array.from({ length: 10 }, () => {
const t0 = performance.now();
- for (let r = 0; r < 100; r++) searchNav(queries[r % queries.length], big);
- return (performance.now() - t0) / 100;
+ for (let r = 0; r < 50; r++) searchNav(queries[r % queries.length], big);
+ return (performance.now() - t0) / 50;
});
expect(Math.min(...rounds)).toBeLessThan(2);
});