Skip to content

Commit 5d4549b

Browse files
authored
merge: test(CustomizeCTA): add TypeScript compiler validation test suite (#8082)
## Description This PR introduces a dedicated TypeScript compiler validation test suite for the CustomizeCTA component to ensure its public type contract remains stable and protected against future regressions. ## Changes Made Added app/components/CustomizeCTA.type-compiler.test.tsx. Verified that CustomizeCTA exports a valid function component. Added compile-time validation for the component's ReactElement return type. Confirmed the component has no required parameters. Ensured the component can be invoked without props. Added a function signature stability check using expectTypeOf. Fixes #6827 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [x] 📐 Pillar 2 — Geometric SVG Improvement - [x] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## 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): ...`). - [x] 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 f9b956a + 1924f28 commit 5d4549b

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// app/components/CustomizeCTA.type-compiler.test.tsx
2+
3+
import { describe, expect, it, expectTypeOf } from 'vitest';
4+
import type { ReactElement } from 'react';
5+
import { CustomizeCTA } from './CustomizeCTA';
6+
7+
describe('CustomizeCTA TypeScript Compiler Validation', () => {
8+
it('exports a function component', () => {
9+
expect(typeof CustomizeCTA).toBe('function');
10+
expectTypeOf(CustomizeCTA).toBeFunction();
11+
});
12+
13+
it('returns a ReactElement', () => {
14+
expectTypeOf<ReturnType<typeof CustomizeCTA>>().toMatchTypeOf<ReactElement>();
15+
});
16+
17+
it('has no required parameters', () => {
18+
expect(CustomizeCTA.length).toBe(0);
19+
});
20+
21+
it('is callable without props', () => {
22+
expect(() => CustomizeCTA()).not.toThrow();
23+
});
24+
25+
it('maintains a stable function signature', () => {
26+
expectTypeOf<typeof CustomizeCTA>().returns.toMatchTypeOf<ReactElement>();
27+
});
28+
});

0 commit comments

Comments
 (0)