Skip to content

Commit 6acaf20

Browse files
authored
test(themes): verify THEME_KEYS matches themes object (JhaSourav07#832)
## Description Fixes JhaSourav07#665 Added a Vitest suite to `app/customize/types.test.ts` to ensure `THEME_KEYS` stays perfectly synchronized with `lib/svg/themes.ts`. It also verifies the presence of the default `auto` and `random` states. ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs, tests) ## Visual Preview <img width="1365" height="767" alt="Screenshot 2026-05-28 090702" src="https://github.com/user-attachments/assets/849b984f-45ff-4b55-a594-cbfa953bb1d2" /> ## 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.
2 parents b47a932 + 373703a commit 6acaf20

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

app/customize/types.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { THEME_KEYS } from './types';
3+
import { themes } from '../../lib/svg/themes';
4+
5+
describe('Theme Keys Synchronization', () => {
6+
it('THEME_KEYS should exactly match the themes object keys plus "auto" and "random"', () => {
7+
// 1. Create the exact array of what should exist
8+
const expectedKeys = ['auto', ...Object.keys(themes), 'random'];
9+
10+
// 2. Sort both arrays alphabetically so the test doesn't fail just because of order
11+
const sortedExpected = expectedKeys.sort();
12+
const sortedActual = [...THEME_KEYS].sort();
13+
14+
// 3. Assert they are 100% identical (no missing keys, no extra obsolete keys)
15+
expect(sortedActual).toEqual(sortedExpected);
16+
});
17+
});

0 commit comments

Comments
 (0)