Skip to content

Commit 9ed3908

Browse files
authored
test(cache): add unicode and emoji character key handling (JhaSourav07#1990)
## Description Fixes JhaSourav07#1404 ## Pillar - [ ] 🎨 Pillar 1 β€” New Theme Design - [ ] πŸ“ Pillar 2 β€” Geometric SVG Improvement - [ ] πŸ• Pillar 3 β€” Timezone Logic Optimization - [x] πŸ› οΈ Other (Bug fix, refactoring, docs) ## Visual Preview ## 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): ...`). - [ ] 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 (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 a36257d + 468a47c commit 9ed3908

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

β€Žlib/cache.test.tsβ€Ž

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,28 @@ describe('TTLCache', () => {
578578
cache.destroy();
579579
});
580580
});
581+
582+
it('stores and retrieves values with unicode and emoji cache keys', () => {
583+
const cache = new TTLCache<string>();
584+
585+
const unicodeKey = 'cache_πŸ”₯_key';
586+
const emojiKey = 'πŸš€_rocket_πŸš€';
587+
const mixedKey = 'user_πŸ‘€_data_πŸ”';
588+
589+
cache.set(unicodeKey, 'fire-value', 60_000);
590+
cache.set(emojiKey, 'rocket-value', 60_000);
591+
cache.set(mixedKey, 'secure-data', 60_000);
592+
593+
expect(cache.get(unicodeKey)).toBe('fire-value');
594+
expect(cache.get(emojiKey)).toBe('rocket-value');
595+
expect(cache.get(mixedKey)).toBe('secure-data');
596+
597+
expect(cache.has(unicodeKey)).toBe(true);
598+
expect(cache.has(emojiKey)).toBe(true);
599+
expect(cache.has(mixedKey)).toBe(true);
600+
601+
cache.destroy();
602+
});
581603
});
582604

583605
import { DistributedCache } from './cache';

0 commit comments

Comments
Β (0)