test: prove TechLog UI migration parity
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { findViteDynamicRouteChunk } from "../../scripts/lib/vite-route-chunks.ts";
|
||||
|
||||
describe("Vite route chunk identity", () => {
|
||||
it("recognizes a governed manual chunk referenced by an entry dynamic import", () => {
|
||||
const manifest = {
|
||||
"_route-tech-log-home-abc.js": {
|
||||
file: "assets/route-tech-log-home-abc.js",
|
||||
name: "route-tech-log-home",
|
||||
},
|
||||
"index.html": {
|
||||
file: "assets/index.js",
|
||||
name: "index",
|
||||
isEntry: true,
|
||||
dynamicImports: ["_route-tech-log-home-abc.js"],
|
||||
},
|
||||
};
|
||||
|
||||
expect(findViteDynamicRouteChunk(manifest, "route-tech-log-home")).toEqual({
|
||||
file: "assets/route-tech-log-home-abc.js",
|
||||
name: "route-tech-log-home",
|
||||
});
|
||||
});
|
||||
|
||||
it("retains Vite native dynamic-entry support", () => {
|
||||
const manifest = {
|
||||
"src/page.tsx": {
|
||||
file: "assets/page.js",
|
||||
name: "route-page",
|
||||
isDynamicEntry: true,
|
||||
},
|
||||
};
|
||||
|
||||
expect(findViteDynamicRouteChunk(manifest, "route-page")?.file).toBe(
|
||||
"assets/page.js",
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects a named chunk that is not dynamically reachable", () => {
|
||||
const manifest = {
|
||||
"_route-tech-log-home-abc.js": {
|
||||
file: "assets/route-tech-log-home-abc.js",
|
||||
name: "route-tech-log-home",
|
||||
},
|
||||
"index.html": {
|
||||
file: "assets/index.js",
|
||||
name: "index",
|
||||
isEntry: true,
|
||||
},
|
||||
};
|
||||
|
||||
expect(findViteDynamicRouteChunk(manifest, "route-tech-log-home")).toBeUndefined();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user