feat(ai-character): 관리자 라우트 지연 로딩 적용
This commit is contained in:
@@ -5,7 +5,7 @@ import { build } from "vite";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
describe("production mock graph", () => {
|
||||
test("excludes the browser mock module from the production bundle", async () => {
|
||||
test("splits production chunks and excludes the browser mock module from the production bundle", async () => {
|
||||
// Given
|
||||
const outDir = mkdtempSync(join(tmpdir(), "ai-character-admin-prod-"));
|
||||
const previousNodeEnv = process.env.NODE_ENV;
|
||||
@@ -21,12 +21,16 @@ describe("production mock graph", () => {
|
||||
mode: "production",
|
||||
});
|
||||
const outputFiles = collectFiles(outDir);
|
||||
const output = outputFiles
|
||||
.filter((filePath) => filePath.endsWith(".js"))
|
||||
const jsFiles = outputFiles.filter((filePath) => filePath.endsWith(".js"));
|
||||
const output = jsFiles
|
||||
.map((filePath) => readFileSync(filePath, "utf8"))
|
||||
.join("\n");
|
||||
|
||||
// Then
|
||||
expect(jsFiles.length).toBeGreaterThanOrEqual(2);
|
||||
for (const jsFile of jsFiles) {
|
||||
expect(statSync(jsFile).size).toBeLessThanOrEqual(500_000);
|
||||
}
|
||||
expect(outputFiles.some((filePath) => filePath.endsWith("mockServiceWorker.js"))).toBe(false);
|
||||
expect(output).not.toContain("mockServiceWorker.js");
|
||||
expect(output).not.toContain("startMockWorker");
|
||||
|
||||
Reference in New Issue
Block a user