Skip to content

Commit 5fe702a

Browse files
committed
test
1 parent 0fc3411 commit 5fe702a

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎tests/reviewApiHelper.test.js‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,22 @@ describe('ReviewApiHelper integration tests', () => {
345345
expect(result.file_contents).not.toHaveProperty('docs/guide.md');
346346
});
347347

348-
it('limits to MAX_REVIEW_FILES (15) unique files', async () => {
349-
for (let i = 1; i <= 18; i++) {
350-
writeFile(`src/file${i}.js`, `const f${i} = ${i};\n`);
348+
it.each([18, 40, 43])('applies the 40-file limit to %i staged files', async (totalFiles) => {
349+
for (let i = 1; i <= totalFiles; i++) {
350+
writeFile(`src/cap/file${i}.js`, `const f${i} = ${i};\n`);
351351
}
352-
git('add -A');
352+
git('add src/cap');
353353

354354
const helper = await createHelper();
355355
const result = await helper.buildReviewApiRequest('staged-only');
356356

357357
const fileCount = Object.keys(result.file_contents).length;
358-
expect(fileCount).toBe(15);
359-
expect(result._meta.max_files).toBe(15);
358+
expect(fileCount).toBe(Math.min(totalFiles, 40));
359+
expect(result._meta.reviewed_files).toHaveLength(fileCount);
360+
expect(result.diff_content.match(/^diff --git /gm)).toHaveLength(fileCount);
361+
expect(result._meta.max_files).toBe(40);
362+
expect(result._meta.capped).toBe(totalFiles > 40);
363+
expect(result._meta.skipped).toHaveLength(Math.max(totalFiles - 40, 0));
360364
});
361365

362366
it('skips files exceeding MAX_FILE_LINES (5000)', async () => {

0 commit comments

Comments
 (0)