Skip to content

Commit 61145e5

Browse files
authored
test(resumeprofilesection): add type compiler validation coverage (JhaSourav07#3249)
## Description Fixes JhaSourav07#2712 This PR adds the new test file: `components/dashboard/ResumeProfileSection.type-compiler.test.tsx` The new test suite validates TypeScript compiler behavior and prop type safety for `ResumeProfileSection.tsx`. It includes type assertions for: * required prop enforcement * strict prop validation * undefined rejection * compile-safe prop structure validation * valid string prop acceptance using `expectTypeOf`. ## Pillar * [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (type compiler test coverage update) ## Checklist before requesting a review: * [x] I have read the `CONTRIBUTING.md` file. * [x] I have tested these changes locally (`localhost:3000/api/streak?user=YOUR_USERNAME`). * [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 started 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 raw elements, smooth animations, correct fonts). * [x] (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents bed8625 + bf4b186 commit 61145e5

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { describe, it, expectTypeOf } from 'vitest';
2+
import ResumeProfileSection from './ResumeProfileSection';
3+
4+
describe('ResumeProfileSection TypeScript compiler validation', () => {
5+
it('accepts valid githubUsername prop type', () => {
6+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
7+
8+
expectTypeOf<Props>().toMatchTypeOf<{
9+
githubUsername: string;
10+
}>();
11+
});
12+
13+
it('enforces githubUsername as required string', () => {
14+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
15+
16+
expectTypeOf<Props['githubUsername']>().toEqualTypeOf<string>();
17+
});
18+
19+
it('does not allow githubUsername to be undefined', () => {
20+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
21+
22+
expectTypeOf<Props['githubUsername']>().not.toEqualTypeOf<string | undefined>();
23+
});
24+
25+
it('validates component props structure', () => {
26+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
27+
28+
const validProps: Props = {
29+
githubUsername: 'aanyacloud',
30+
};
31+
32+
expectTypeOf(validProps.githubUsername).toBeString();
33+
});
34+
35+
it('supports strict prop type checking', () => {
36+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
37+
38+
expectTypeOf<Props>().toExtend<{
39+
githubUsername: string;
40+
}>();
41+
});
42+
43+
it('supports valid string values for githubUsername', () => {
44+
type Props = React.ComponentProps<typeof ResumeProfileSection>;
45+
46+
const props: Props = {
47+
githubUsername: '',
48+
};
49+
50+
expectTypeOf(props.githubUsername).toBeString();
51+
});
52+
});

0 commit comments

Comments
 (0)