refactor(canvas): 预演台 - 重构工作台与场景交互链路
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { runInNewContext } from "node:vm";
|
||||
|
||||
import { isIsolatedDirectorRepro } from "../src/lib/dev-repro";
|
||||
import { isIsolatedPrevisRepro } from "../src/lib/dev-repro";
|
||||
|
||||
// Execute the real entry point; replace only its font, network and UI side effects.
|
||||
async function prepareEntry(dev, pathname) {
|
||||
@@ -39,18 +39,18 @@ async function prepareEntry(dev, pathname) {
|
||||
return { events, resolveAppearance, loaded };
|
||||
}
|
||||
|
||||
test("DEV director lab loads without calling the appearance backend", async () => {
|
||||
const entry = await prepareEntry(true, "/dev/director-repro");
|
||||
test("DEV previs lab loads without calling the appearance backend", async () => {
|
||||
const entry = await prepareEntry(true, "/dev/previs-repro");
|
||||
await entry.loaded;
|
||||
expect(entry.events).toEqual(["./application"]);
|
||||
});
|
||||
|
||||
for (const [dev, pathname] of [
|
||||
[false, "/dev/director-repro"],
|
||||
[false, "/dev/previs-repro"],
|
||||
[true, "/login"],
|
||||
[false, "/login"],
|
||||
[true, "/dev/director-repro/"],
|
||||
[true, "/dev/director-repro-other"],
|
||||
[true, "/dev/previs-repro/"],
|
||||
[true, "/dev/previs-repro-other"],
|
||||
]) {
|
||||
test(`appearance loads in parallel with normal startup: dev=${dev} path=${pathname}`, async () => {
|
||||
const entry = await prepareEntry(dev, pathname);
|
||||
@@ -69,9 +69,9 @@ for (const pathname of ["/welcome", "/welcome/"]) {
|
||||
}
|
||||
|
||||
test("provider isolation shares the exact DEV-only route boundary", () => {
|
||||
expect(isIsolatedDirectorRepro(true, "/dev/director-repro")).toBe(true);
|
||||
expect(isIsolatedDirectorRepro(false, "/dev/director-repro")).toBe(false);
|
||||
for (const path of ["/", "/login", "/dev/director-repro/", "/dev/director-repro-other"]) {
|
||||
expect(isIsolatedDirectorRepro(true, path)).toBe(false);
|
||||
expect(isIsolatedPrevisRepro(true, "/dev/previs-repro")).toBe(true);
|
||||
expect(isIsolatedPrevisRepro(false, "/dev/previs-repro")).toBe(false);
|
||||
for (const path of ["/", "/login", "/dev/previs-repro/", "/dev/previs-repro-other"]) {
|
||||
expect(isIsolatedPrevisRepro(true, path)).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user