Skip to content

Commit eb265c1

Browse files
authored
test(resume-parser): add type compiler coverage (JhaSourav07#3150)
## Description Fixes JhaSourav07#2882 Added type-level tests for `lib/resume-parser.ts` focusing on TypeScript compiler validation, schema stability, and API contract safety. ### Changes - Added `lib/resume-parser.type-compiler.test.ts` - Verified `parseResume` returns `Promise<ParsedResume>` - Tested `parseResume` parameter type contracts (`Buffer`, `string`) - Confirmed `ParsedResume` structure remains type-safe and stable - Verified `Education` and `Experience` collections are correctly typed within parsed results - Tested `ALLOWED_MIME_TYPES` maintains string array typing - Confirmed `MAX_FILE_SIZE` remains a numeric constant - Improved protection against accidental type regressions and API contract changes ## 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 (test-only changes) ## 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 (CI will fail otherwise). - [x] My commits follow the Conventional Commits format (e.g., `feat(themes): ...`, `fix(calculate): ...`). - [ ] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have starred the repo. - [x] I have made sure that I have only one commit to merge in this PR. - [x] The SVG output matches the CommitPulse "premium quality" aesthetic standard (no visual changes made). - [ ] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 61fe7d7 + 8a8b619 commit eb265c1

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// lib/resume-parser.type-compiler.test.ts
2+
3+
import { describe, expectTypeOf, it } from 'vitest';
4+
import { parseResume, ALLOWED_MIME_TYPES, MAX_FILE_SIZE } from './resume-parser';
5+
6+
import type { ParsedResume, Education, Experience } from '@/types/student';
7+
8+
describe('Resume Parser Type Compiler Validation', () => {
9+
it('returns a Promise of ParsedResume', () => {
10+
expectTypeOf(parseResume).returns.toEqualTypeOf<Promise<ParsedResume>>();
11+
});
12+
13+
it('accepts expected parseResume parameter types', () => {
14+
expectTypeOf(parseResume).parameters.toEqualTypeOf<[Buffer, string]>();
15+
});
16+
17+
it('validates ParsedResume structure', () => {
18+
expectTypeOf<ParsedResume>().toMatchTypeOf({
19+
name: '',
20+
email: '',
21+
phone: '',
22+
skills: [] as string[],
23+
education: [] as Education[],
24+
experience: [] as Experience[],
25+
});
26+
});
27+
28+
it('enforces allowed mime types array typing', () => {
29+
expectTypeOf(ALLOWED_MIME_TYPES).toEqualTypeOf<string[]>();
30+
});
31+
32+
it('enforces MAX_FILE_SIZE numeric typing', () => {
33+
expectTypeOf(MAX_FILE_SIZE).toEqualTypeOf<number>();
34+
});
35+
});

0 commit comments

Comments
 (0)