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.

Settings links test: the Settings page's own sections and other apps' settings

Claude7c1d40a35af3
diff --git a/tests/settings-links.test.ts b/tests/settings-links.test.ts
index cae146ea..1bf56f2d 100644
--- a/tests/settings-links.test.ts
+++ b/tests/settings-links.test.ts
@@ -7,8 +7,10 @@ import { describe, expect, it } from "vitest";
const root = path.join(__dirname, "../src");
const files = (d: string): string[] => fs.readdirSync(d, { withFileTypes: true }).flatMap((e) => (e.isDirectory() ? files(path.join(d, e.name)) : /\.tsx?$/.test(e.name) ? [path.join(d, e.name)] : []));
const form = fs.readFileSync(path.join(root, "components/settings-form.tsx"), "utf8");
+/** What the Settings page shows (src/app/(studio)/settings/page.tsx): the form, and the sections around it (Your GPU, Accounts). */
+const page = ["components/settings-form.tsx", "components/gpu/account-gpu-section.tsx", "components/accounts-admin.tsx"].map((f) => fs.readFileSync(path.join(root, f), "utf8")).join("\n");
/** The anchors Settings has: its sections' and fields' ids (id="…", or a Section's id prop on its own line). */
-const anchors = new Set([...form.matchAll(/\bid="([a-z0-9-]+)"/g)].map((m) => m[1]));
+const anchors = new Set([...page.matchAll(/\bid="([a-z0-9-]+)"/g)].map((m) => m[1]));
describe("Settings deep links", () => {
it("every /settings#… link in the app has its anchor", () => {
@@ -19,8 +21,8 @@ describe("Settings deep links", () => {
it("every \"Settings → …\" the app tells people names a section or field Settings has", () => {
// Section titles ("Prompt enhancement · Claude or Ollama": the whole, or either side of the "·") and field labels.
- const titles = [...form.matchAll(/\btitle="([^"]+)"/g)].map((m) => m[1]);
- const labels = [...form.matchAll(/\blabel="([^"]+)"/g)].map((m) => m[1]);
+ const titles = [...page.matchAll(/\btitle="([^"]+)"/g)].map((m) => m[1]);
+ const labels = [...page.matchAll(/\blabel="([^"]+)"/g)].map((m) => m[1]);
const norm = (x: string) => x.replace(/&/g, "&").replace(/\s*·\s*/g, " ").toLowerCase();
const names = [...titles, ...titles.flatMap((t) => t.split("·").map((x) => x.trim())), ...labels].map(norm);
const places = files(root).flatMap((f) =>
@@ -29,7 +31,8 @@ describe("Settings deep links", () => {
.split("\n")
// What people read, not the comments around it.
.filter((l) => !/^\s*(\/\/|\*|\/\*)/.test(l))
- .flatMap((l) => [...l.replace(/&amp;/g, "&").matchAll(/Settings → ([^`"'.,;:()${}<]+)/g)].map((m) => ({ file: path.relative(root, f), place: m[1].trim() }))),
+ // Another app's settings (LM Studio's Developer → Server Settings, Unsloth Studio's avatar → Settings) aren't Fuobe's.
+ .flatMap((l) => [...l.replace(/&amp;/g, "&").matchAll(/(?<!(?:→|Server) )Settings → ([^`"'.,;:()${}<]+)/g)].map((m) => ({ file: path.relative(root, f), place: m[1].trim() }))),
);
expect(places.length).toBeGreaterThan(20);
const unknown = places.filter((p) => p.place && !names.some((n) => norm(p.place) === n || norm(p.place).startsWith(`${n} `)));