Commit 841af16
authored
Add type compiler validation tests for GitHubUserValidator (JhaSourav07#3098)
## Description
Closes JhaSourav07#2962
Adds type-level compiler tests for the `GitHubUserValidator` class in
`services/github/validate-user.ts`. The test file uses Vitest's
`expectTypeOf` to verify the public API signatures of `validateUser`,
`getInstance`, and `reset` methods, including negative type assertions
that ensure non-string types are not accepted by `validateUser`.
## Pillar
- [x] 🛠️ Other (Test coverage for type compiler validation)
## What changed
- Added `services/github/validate-user.type-compiler.test.ts` with 5
test cases:
- Parameter and return type assertions for `validateUser`
- Singleton instance pattern type verification for `getInstance`
- Return type verification for `reset` method (`void`)
- Negative type assertions ensuring only strings are accepted
- Schema validation constraints return type verification
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally (`npx vitest run
services/github/validate-user.type-compiler.test.ts`).
- [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 made sure that I have only one commit to merge in this PR.1 file changed
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments