Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import { describe, it } from "node:test";
|
||||
|
||||
const appSource = readFileSync(new URL("../App.tsx", import.meta.url), "utf8");
|
||||
const routesSourcePath = new URL("../routes/appRoutes.tsx", import.meta.url);
|
||||
const readRoutesSource = () => {
|
||||
assert.equal(existsSync(routesSourcePath), true, "expected src/routes/appRoutes.tsx to exist");
|
||||
return readFileSync(routesSourcePath, "utf8");
|
||||
};
|
||||
|
||||
describe("App route splitting", () => {
|
||||
it("loads route pages lazily instead of statically importing every page into the first bundle", () => {
|
||||
const routesSource = readRoutesSource();
|
||||
|
||||
assert.doesNotMatch(appSource, /^import\s+\w+\s+from\s+["']\.\/pages\//m);
|
||||
assert.doesNotMatch(appSource, /lazy\(\s*\(\)\s*=>\s*import\(["']\.\/pages\//);
|
||||
assert.match(routesSource, /lazy\(\s*\(\)\s*=>\s*import\(["']\.\.\/pages\//);
|
||||
});
|
||||
|
||||
it("wraps lazy routes in Suspense with an operator-friendly loading state", () => {
|
||||
assert.match(appSource, /Suspense/);
|
||||
assert.match(appSource, /Routes laden/);
|
||||
});
|
||||
|
||||
it("keeps route definitions in a dedicated manifest instead of the app shell", () => {
|
||||
const routesSource = readRoutesSource();
|
||||
|
||||
assert.match(appSource, /import\s+\{\s*appRoutes\s*\}\s+from\s+["']\.\/routes\/appRoutes["']/);
|
||||
assert.doesNotMatch(appSource, /<Route\s+path=/);
|
||||
assert.match(routesSource, /export\s+const\s+appRoutes/);
|
||||
assert.match(routesSource, /path:\s*["']\/ai\/security-reviewer["']/);
|
||||
assert.match(routesSource, /path:\s*["']\*["']/);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user