|
| 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