File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -556,6 +556,28 @@ describe('TTLCache', () => {
556556 cache . destroy ( ) ;
557557 } ) ;
558558 } ) ;
559+
560+ it ( 'stores and retrieves values with unicode and emoji cache keys' , ( ) => {
561+ const cache = new TTLCache < string > ( ) ;
562+
563+ const unicodeKey = 'cache_🔥_key' ;
564+ const emojiKey = '🚀_rocket_🚀' ;
565+ const mixedKey = 'user_👤_data_🔐' ;
566+
567+ cache . set ( unicodeKey , 'fire-value' , 60_000 ) ;
568+ cache . set ( emojiKey , 'rocket-value' , 60_000 ) ;
569+ cache . set ( mixedKey , 'secure-data' , 60_000 ) ;
570+
571+ expect ( cache . get ( unicodeKey ) ) . toBe ( 'fire-value' ) ;
572+ expect ( cache . get ( emojiKey ) ) . toBe ( 'rocket-value' ) ;
573+ expect ( cache . get ( mixedKey ) ) . toBe ( 'secure-data' ) ;
574+
575+ expect ( cache . has ( unicodeKey ) ) . toBe ( true ) ;
576+ expect ( cache . has ( emojiKey ) ) . toBe ( true ) ;
577+ expect ( cache . has ( mixedKey ) ) . toBe ( true ) ;
578+
579+ cache . destroy ( ) ;
580+ } ) ;
559581} ) ;
560582
561583import { DistributedCache } from './cache' ;
You can’t perform that action at this time.
0 commit comments