Commit 392b7c3
authored
test(utils): check username truncator boundary robustness (JhaSourav07#1563) (JhaSourav07#1665)
## Description
Fixes JhaSourav07#1563
Added a boundary robustness test for username truncation behavior in the
SVG generator.
The new test verifies that usernames longer than 30 characters are
safely truncated with trailing dots while ensuring SVG layout and
geometry remain valid.
## Pillar
* [ ] 🎨 Pillar 1 — New Theme Design
* [ ] 📐 Pillar 2 — Geometric SVG Improvement
* [ ] 🕐 Pillar 3 — Timezone Logic Optimization
* [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
N/A (test-only changes)
## 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`).
* [ ] 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.
* [ ] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (not applicable for test-only changes).
* [ ] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.
## Test Validation
Command executed:
```bash
npx vitest run lib/svg/generator.test.ts
```
Result:
```text
✓ lib/svg/generator.test.ts
Test Files 1 passed (1)
Tests 102 passed (102)
```
## Files Changed
* lib/svg/generator.test.ts
## Notes
* Added one new boundary-focused test block.
* Verified truncation behavior for usernames longer than 30 characters.
* Verified SVG geometry remains valid after truncation.
* No production code changes were made.1 file changed
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1283 | 1283 | | |
1284 | 1284 | | |
1285 | 1285 | | |
| 1286 | + | |
| 1287 | + | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
1286 | 1306 | | |
0 commit comments