Skip to content

Commit 2e7ac63

Browse files
committed
fix: address review comments — restore help tests and add .options assertions
- Restore deploy --help and dev --help flag-level assertions (integ smoke test only checks exit code and "Usage:", not specific flags) - Restore --invoke negative regression guard in dev.test.ts - Replace representative-sample enum tests with .options assertions for AgentCoreRegionSchema and GatewayTargetTypeSchema (catches accidental removal of enum values)
1 parent e18b1f1 commit 2e7ac63

4 files changed

Lines changed: 61 additions & 7 deletions

File tree

src/cli/commands/deploy/__tests__/deploy.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ import { tmpdir } from 'node:os';
55
import { join } from 'node:path';
66
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
77

8+
describe('deploy --help', () => {
9+
it('shows all deploy options', async () => {
10+
const result = await runCLI(['deploy', '--help'], process.cwd());
11+
expect(result.exitCode).toBe(0);
12+
expect(result.stdout.includes('--yes')).toBeTruthy();
13+
expect(result.stdout.includes('--verbose')).toBeTruthy();
14+
expect(result.stdout.includes('--json')).toBeTruthy();
15+
expect(result.stdout.includes('--dry-run')).toBeTruthy();
16+
expect(result.stdout.includes('resource-level'), 'Should describe resource-level events').toBeTruthy();
17+
});
18+
});
19+
820
describe('deploy without agents', () => {
921
let noAgentTestDir: string;
1022
let noAgentProjectDir: string;

src/cli/commands/dev/__tests__/dev.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@ import { runCLI } from '../../../../test-utils/index.js';
22
import { describe, expect, it } from 'vitest';
33

44
describe('dev command', () => {
5+
describe('--help', () => {
6+
it('shows all options', async () => {
7+
const result = await runCLI(['dev', '--help'], process.cwd());
8+
9+
expect(result.exitCode).toBe(0);
10+
expect(result.stdout.includes('[prompt]'), 'Should show [prompt] positional argument').toBeTruthy();
11+
expect(result.stdout.includes('--port'), 'Should show --port option').toBeTruthy();
12+
expect(result.stdout.includes('--runtime'), 'Should show --runtime option').toBeTruthy();
13+
expect(result.stdout.includes('--stream'), 'Should show --stream option').toBeTruthy();
14+
expect(result.stdout.includes('--logs'), 'Should show --logs option').toBeTruthy();
15+
expect(result.stdout.includes('8080'), 'Should show default port').toBeTruthy();
16+
});
17+
18+
it('does not show --invoke flag', async () => {
19+
const result = await runCLI(['dev', '--help'], process.cwd());
20+
21+
expect(result.exitCode).toBe(0);
22+
expect(result.stdout.includes('--invoke'), 'Should not show removed --invoke option').toBeFalsy();
23+
});
24+
});
25+
526
describe('requires project context', () => {
627
it('exits with error when run outside project', async () => {
728
const result = await runCLI(['dev'], process.cwd());

src/schema/schemas/__tests__/aws-targets.test.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,25 @@ import {
88
import { describe, expect, it } from 'vitest';
99

1010
describe('AgentCoreRegionSchema', () => {
11-
it('accepts representative valid regions', () => {
12-
expect(AgentCoreRegionSchema.safeParse('us-east-1').success).toBe(true);
13-
expect(AgentCoreRegionSchema.safeParse('eu-west-1').success).toBe(true);
14-
expect(AgentCoreRegionSchema.safeParse('us-gov-west-1').success).toBe(true);
11+
it('enumerates all supported regions', () => {
12+
expect(AgentCoreRegionSchema.options).toEqual([
13+
'ap-northeast-1',
14+
'ap-northeast-2',
15+
'ap-south-1',
16+
'ap-southeast-1',
17+
'ap-southeast-2',
18+
'ca-central-1',
19+
'eu-central-1',
20+
'eu-north-1',
21+
'eu-west-1',
22+
'eu-west-2',
23+
'eu-west-3',
24+
'sa-east-1',
25+
'us-east-1',
26+
'us-east-2',
27+
'us-west-2',
28+
'us-gov-west-1',
29+
]);
1530
});
1631

1732
it('rejects unsupported regions and invalid values', () => {

src/schema/schemas/__tests__/mcp.test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ import {
2121
import { describe, expect, it } from 'vitest';
2222

2323
describe('GatewayTargetTypeSchema', () => {
24-
it('accepts valid target types', () => {
25-
expect(GatewayTargetTypeSchema.safeParse('lambda').success).toBe(true);
26-
expect(GatewayTargetTypeSchema.safeParse('lambdaFunctionArn').success).toBe(true);
24+
it('enumerates all target types', () => {
25+
expect(GatewayTargetTypeSchema.options).toEqual([
26+
'lambda',
27+
'mcpServer',
28+
'openApiSchema',
29+
'smithyModel',
30+
'apiGateway',
31+
'lambdaFunctionArn',
32+
]);
2733
});
2834

2935
it('rejects invalid type', () => {

0 commit comments

Comments
 (0)