Skip to content

Commit ede13ef

Browse files
committed
test(resumeprofilesection): add type compiler validation coverage
1 parent e3369ea commit ede13ef

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)