|
| 1 | +// lib/resume-parser.timezone-boundaries.test.ts |
| 2 | + |
| 3 | +import { describe, expect, it } from 'vitest'; |
| 4 | +import { parseResume } from './resume-parser'; |
| 5 | + |
| 6 | +describe('Resume Parser Timezone Boundaries', () => { |
| 7 | + it('parses resume data consistently with UTC date strings', async () => { |
| 8 | + const resume = ` |
| 9 | +John Doe |
| 10 | +john@example.com |
| 11 | +
|
| 12 | +Experience |
| 13 | +Software Engineer 2020-2024 UTC |
| 14 | +`; |
| 15 | + |
| 16 | + const result = await parseResume(Buffer.from(resume), 'application/pdf'); |
| 17 | + |
| 18 | + expect(result).toBeDefined(); |
| 19 | + expect(typeof result.name).toBe('string'); |
| 20 | + }); |
| 21 | + |
| 22 | + it('parses resume data consistently with EST date strings', async () => { |
| 23 | + const resume = ` |
| 24 | +John Doe |
| 25 | +john@example.com |
| 26 | +
|
| 27 | +Experience |
| 28 | +Software Engineer 2020-2024 EST |
| 29 | +`; |
| 30 | + |
| 31 | + const result = await parseResume(Buffer.from(resume), 'application/pdf'); |
| 32 | + |
| 33 | + expect(result).toBeDefined(); |
| 34 | + expect(result.experience).toBeDefined(); |
| 35 | + }); |
| 36 | + |
| 37 | + it('parses resume data consistently with IST date strings', async () => { |
| 38 | + const resume = ` |
| 39 | +John Doe |
| 40 | +john@example.com |
| 41 | +
|
| 42 | +Education |
| 43 | +University Degree 2019-2023 IST |
| 44 | +`; |
| 45 | + |
| 46 | + const result = await parseResume(Buffer.from(resume), 'application/pdf'); |
| 47 | + |
| 48 | + expect(result).toBeDefined(); |
| 49 | + expect(result.education).toBeDefined(); |
| 50 | + }); |
| 51 | + |
| 52 | + it('handles leap-year date references without failures', async () => { |
| 53 | + const resume = ` |
| 54 | +John Doe |
| 55 | +john@example.com |
| 56 | +
|
| 57 | +Experience |
| 58 | +Project Lead Feb 29 2024 |
| 59 | +`; |
| 60 | + |
| 61 | + const result = await parseResume(Buffer.from(resume), 'application/pdf'); |
| 62 | + |
| 63 | + expect(result).toBeDefined(); |
| 64 | + }); |
| 65 | + |
| 66 | + it('handles daylight-saving and boundary date text safely', async () => { |
| 67 | + const resume = ` |
| 68 | +John Doe |
| 69 | +john@example.com |
| 70 | +
|
| 71 | +Experience |
| 72 | +Engineer March 10 2024 DST |
| 73 | +`; |
| 74 | + |
| 75 | + const result = await parseResume(Buffer.from(resume), 'application/pdf'); |
| 76 | + |
| 77 | + expect(result).toBeDefined(); |
| 78 | + expect(result.email).toBe('john@example.com'); |
| 79 | + }); |
| 80 | +}); |
0 commit comments