feat: remove nextjs production runtime (#1389)
This commit is contained in:
@@ -17,7 +17,9 @@ function createFakeBundle(dir: string) {
|
||||
fs.writeFileSync(path.join(dir, "bin", "kandev"), "fake");
|
||||
fs.writeFileSync(path.join(dir, "bin", "agentctl"), "fake");
|
||||
fs.mkdirSync(path.join(dir, "web"), { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, "web", "server.js"), "fake");
|
||||
fs.writeFileSync(path.join(dir, "web", "index.html"), '<div id="root"></div>');
|
||||
fs.mkdirSync(path.join(dir, "web", "assets"), { recursive: true });
|
||||
fs.writeFileSync(path.join(dir, "web", "assets", "index.js"), "fake");
|
||||
}
|
||||
|
||||
describe("validateBundle", () => {
|
||||
@@ -40,7 +42,7 @@ describe("validateBundle", () => {
|
||||
fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, "bin", "agentctl"), "fake");
|
||||
fs.mkdirSync(path.join(tmpDir, "web"), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, "web", "server.js"), "fake");
|
||||
fs.writeFileSync(path.join(tmpDir, "web", "index.html"), "");
|
||||
expect(() => validateBundle(tmpDir)).toThrow(/Backend binary not found/);
|
||||
});
|
||||
|
||||
@@ -48,15 +50,20 @@ describe("validateBundle", () => {
|
||||
fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, "bin", "kandev"), "fake");
|
||||
fs.mkdirSync(path.join(tmpDir, "web"), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, "web", "server.js"), "fake");
|
||||
fs.writeFileSync(path.join(tmpDir, "web", "index.html"), "");
|
||||
expect(() => validateBundle(tmpDir)).toThrow(/agentctl binary not found/);
|
||||
});
|
||||
|
||||
it("throws when web server.js is missing", () => {
|
||||
it("does not require external web assets", () => {
|
||||
fs.mkdirSync(path.join(tmpDir, "bin"), { recursive: true });
|
||||
fs.writeFileSync(path.join(tmpDir, "bin", "kandev"), "fake");
|
||||
fs.writeFileSync(path.join(tmpDir, "bin", "agentctl"), "fake");
|
||||
expect(() => validateBundle(tmpDir)).toThrow(/Web server.*not found/);
|
||||
expect(() => validateBundle(tmpDir)).not.toThrow();
|
||||
});
|
||||
|
||||
it("does not require a Node web server in the runtime bundle", () => {
|
||||
createFakeBundle(tmpDir);
|
||||
expect(() => validateBundle(tmpDir)).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user