From 04fe75e8e412afcec173d973e28184f0badb503c Mon Sep 17 00:00:00 2001 From: ScriptedAlchemy Date: Wed, 2 Sep 2026 04:45:33 +0000 Subject: [PATCH] test: ship a plain script in the packed one-build fixture (#102) --- .../tests/cli-routes-build.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/agent-bundle/tests/cli-routes-build.test.ts b/packages/agent-bundle/tests/cli-routes-build.test.ts index f24582d35..8d6b9e530 100644 --- a/packages/agent-bundle/tests/cli-routes-build.test.ts +++ b/packages/agent-bundle/tests/cli-routes-build.test.ts @@ -141,6 +141,15 @@ it('builds and runs the generated routed-CLI executable', { retry: 2, timeout: 1 '}', '', ].join('\n')), + writeProjectFile(root, 'src/scripts/checksum.ts', [ + 'const checksum = async (): Promise => {', + " process.stdout.write('Fixture checksum: 102\\n');", + ' return 0;', + '};', + 'export default checksum;', + 'export { checksum as main };', + '', + ].join('\n')), writeProjectFile(root, 'src/scripts/summarize.tsx', [ "import React from 'react';", "import { Agent } from '@agent-bundle/runtime';", @@ -275,4 +284,13 @@ it('builds and runs the generated routed-CLI executable', { retry: 2, timeout: 1 expect(scriptMarkdown.stdout).toBe('Summarized 2 arguments.\n'); const scriptJson = await execFile(process.execPath, [scriptPath, 'alpha', '--json']); expect(JSON.parse(scriptJson.stdout)).toEqual({ arguments: 1 }); + + // #102 acceptance: one build ships custom, MCP-generated, plain, and rendered commands/scripts. + const plainScriptPath = join(root, 'artifact', 'portable', 'scripts', 'checksum.mjs'); + await expect(stat(plainScriptPath)).resolves.toMatchObject({}); + const plainScript = await execFile(process.execPath, [plainScriptPath]); + expect(plainScript.stdout).toBe('Fixture checksum: 102\n'); + await expect(stat(join(root, 'artifact', 'portable', 'scripts', 'checksum-flight.mjs'))).rejects.toMatchObject({ + code: 'ENOENT', + }); });