Skip to content

Commit f983222

Browse files
authored
test(resume-parser): add massive-scaling test suite (JhaSourav07#2874) (JhaSourav07#3004)
## Description Adds the comprehensive `resume-parser.massive-scaling.test.ts` test suite to verify the performance, bounds validation, and execution speed under massive scaling conditions. This includes handling 2,000+ distinct skills, 500+ education/experience items, and exactly 5MB maximum file size inputs. Fixes JhaSourav07#2874 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (Utility/Unit Tests only) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors. - [x] My commits follow the Conventional Commits format. - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [ ] The SVG output matches the CommitPulse "premium quality" aesthetic standard. - [ ] (Recommended) I joined the CommitPulse Discord community.
1 parent e2a5400 commit f983222

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { parseResume, MAX_FILE_SIZE } from './resume-parser';
3+
4+
describe('resume-parser-massive-scaling', () => {
5+
it('should parse 2,000 distinct skills efficiently without performance degradation', async () => {
6+
const skillsList = Array.from({ length: 2000 }, (_, i) => `SkillName${i}`);
7+
const text = `John Doe\nSkills\n${skillsList.join(', ')}`;
8+
const buffer = Buffer.from(text);
9+
10+
const startTime = Date.now();
11+
const result = await parseResume(buffer, 'application/pdf');
12+
const duration = Date.now() - startTime;
13+
14+
expect(duration).toBeLessThan(500); // completed within 500ms
15+
expect(result.skills.length).toBe(2000);
16+
expect(result.skills[0]).toBe('SkillName0');
17+
expect(result.skills[1999]).toBe('SkillName1999');
18+
});
19+
20+
it('should handle a large number of education entries (500 entries) correctly', async () => {
21+
const educationLines: string[] = [];
22+
for (let i = 0; i < 500; i++) {
23+
educationLines.push(`University Number ${i} 2010 - 2014`);
24+
}
25+
const text = `John Doe\nEducation\n${educationLines.join('\n')}`;
26+
const buffer = Buffer.from(text);
27+
28+
const startTime = Date.now();
29+
const result = await parseResume(buffer, 'application/pdf');
30+
const duration = Date.now() - startTime;
31+
32+
expect(duration).toBeLessThan(1000);
33+
expect(result.education.length).toBe(500);
34+
expect(result.education[0].institution).toBe('University Number 0 2010 - 2014');
35+
expect(result.education[499].institution).toBe('University Number 499 2010 - 2014');
36+
});
37+
38+
it('should handle a large number of experience entries (500 entries) correctly', async () => {
39+
const experienceLines: string[] = [];
40+
for (let i = 0; i < 500; i++) {
41+
experienceLines.push(`Company Name ${i} 2015 to 2019`);
42+
}
43+
const text = `John Doe\nExperience\n${experienceLines.join('\n')}`;
44+
const buffer = Buffer.from(text);
45+
46+
const startTime = Date.now();
47+
const result = await parseResume(buffer, 'application/pdf');
48+
const duration = Date.now() - startTime;
49+
50+
expect(duration).toBeLessThan(1000);
51+
expect(result.experience.length).toBe(500);
52+
expect(result.experience[0].company).toBe('Company Name 0 2015 to 2019');
53+
expect(result.experience[499].company).toBe('Company Name 499 2015 to 2019');
54+
});
55+
56+
it('should process a file matching exactly the maximum allowed file size boundary (5MB) without crashing', async () => {
57+
// Generate a 5MB string with a valid name, email and some text
58+
const header = 'John Doe\njohn.doe@example.com\n';
59+
const fillSize = MAX_FILE_SIZE - Buffer.byteLength(header);
60+
const filler = 'A'.repeat(fillSize);
61+
const buffer = Buffer.from(header + filler);
62+
63+
expect(buffer.byteLength).toBe(MAX_FILE_SIZE);
64+
65+
const startTime = Date.now();
66+
const result = await parseResume(buffer, 'application/pdf');
67+
const duration = Date.now() - startTime;
68+
69+
expect(duration).toBeLessThan(2000); // 5MB parsed in under 2 seconds
70+
expect(result.name).toBe('John Doe');
71+
expect(result.email).toBe('john.doe@example.com');
72+
});
73+
});

0 commit comments

Comments
 (0)