Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/commands/test.result.history.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,32 @@ describe('runResultHistory — pagination', () => {

expect(capturedUrl).toContain('pageSize=5');
});

it('rejects fractional --page-size before making a request', async () => {
const { credentialsPath } = makeCreds();
const fetchImpl = makeFetch(() => {
throw new Error('should not be called');
});

await expect(
runResultHistory(
{
output: 'json',
testId: 'test_abc',
pageSize: 1.5,
profile: 'default',
dryRun: false,
debug: false,
verbose: false,
},
{ credentialsPath, fetchImpl, stdout: () => {} },
),
).rejects.toMatchObject({
code: 'VALIDATION_ERROR',
exitCode: 5,
details: expect.objectContaining({ field: 'page-size' }),
});
});
});

// ---------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion src/commands/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3799,7 +3799,10 @@ export async function runResultHistory(
// configured (codex round-2), matching validatePaginationFlags ordering
// in `test list` / `project list`.
if (opts.pageSize !== undefined) {
if (!Number.isFinite(opts.pageSize) || opts.pageSize < 1 || opts.pageSize > 100) {
if (!Number.isFinite(opts.pageSize) || !Number.isInteger(opts.pageSize)) {
throw localValidationError('page-size', 'must be an integer between 1 and 100');
}
if (opts.pageSize < 1 || opts.pageSize > 100) {
throw localValidationError('page-size', 'must be between 1 and 100');
}
}
Expand Down