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: the studio example row's skeleton and feed wait, and Ads Studio's row

Adarshb12fe08f5eac
diff --git a/tests/instant-tabs.test.ts b/tests/instant-tabs.test.ts
index 9eb19765..ef4a517e 100644
--- a/tests/instant-tabs.test.ts
+++ b/tests/instant-tabs.test.ts
@@ -167,9 +167,12 @@ describe("other tab bars switch without a round trip", () => {
// the route's skeleton after the tap.
const page = src("src/components/studio/studio-page.tsx");
const lazy = page.split("\n").filter((l) => /^const \w+ = dynamic\(\(\) => import\("@\/components\/examples\/example-cards"\)/.test(l));
- expect(lazy.length).toBe(3);
+ expect(lazy.length).toBe(2);
for (const line of lazy) expect(line).toMatch(/\{ loading: /);
- expect(page).toMatch(/loading: ExampleCardsPlaceholder \}/);
+ // The row is a lazy() under its own Suspense boundary, whose fallback is the row's skeleton (the same heading and cards).
+ expect(page).toMatch(/^const ExampleRow = lazy\(\(\) => import\("@\/components\/examples\/example-cards"\)/m);
+ expect(page).toMatch(/<Suspense fallback=\{skeleton\}>\s*<ExampleRow /);
+ expect(page).toMatch(/const skeleton = <ExampleRowSkeleton /);
});
});
diff --git a/tests/studio-examples.test.ts b/tests/studio-examples.test.ts
index cc485159..c03fc664 100644
--- a/tests/studio-examples.test.ts
+++ b/tests/studio-examples.test.ts
@@ -137,7 +137,8 @@ describe("the studios' examples", () => {
const code = read(...f);
expect(code, f.join("/")).toMatch(/^import type \{ ExampleRowData \} from "@\/lib\/examples\/types";$/m);
expect(code, f.join("/")).not.toMatch(/from "@\/lib\/(studio-examples|examples\/catalog)"/);
- expect(code, `${s}: ${f.join("/")}`).toContain("<ExampleRow row={examples}");
+ // Ads Studio's row leaves out the cards its own ready brands already show (moreToTry, from its examples).
+ expect(code, `${s}: ${f.join("/")}`).toMatch(/<ExampleRow row=\{(examples|moreToTry)\}/);
}
}
});
@@ -161,7 +162,10 @@ describe("the studios' examples", () => {
it("shows only once the feed is known to be empty, and a loaded example goes to its own studio's composer", () => {
const page = read("components", "studio", "studio-page.tsx");
- expect(page).toMatch(/\{feed\.isSuccess && !hasItems && !!examples\?\.cards\.length && <StudioExamples /);
+ // Its skeleton until the feed has answered; the cards then (a guest's after FEED_WAIT_MS at most), never for results.
+ expect(page).toMatch(/\{!hasItems && !!examples\?\.cards\.length && <StudioExamples row=\{examples\} ready=\{!feed\.isPending\} \/>\}/);
+ expect(page).toMatch(/if \(!ready && !\(guest && waited\)\) return skeleton;/);
+ expect(page).toMatch(/if \(ready \|\| !guest\) return;/);
expect(read("components", "studio", "composer.tsx")).toMatch(/bridgeRef\.pick = pickPreset;/);
// Its own studio's composer, not a hidden studio's (one left earlier stays in the page).
expect(page).toMatch(/document\.querySelectorAll<HTMLElement>\("\[data-studio\] \[data-composer\]"\)\]\.find\(\(el\) => el\.offsetParent !== null\)/);