File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ describe('Cache', () => {
1919 } ) ;
2020
2121 test ( 'expects to throw error if TTL is not positive' , ( ) => {
22+ expect ( ( ) => new Cache < string > ( 0 ) ) . toThrow ( 'TTL must be positive' ) ;
2223 expect ( ( ) => new Cache < string > ( - 1 ) ) . toThrow ( 'TTL must be positive' ) ;
2324 expect ( ( ) => new Cache < string > ( - 2 ) ) . toThrow ( 'TTL must be positive' ) ;
2425 } ) ;
@@ -202,6 +203,12 @@ describe('Cache', () => {
202203 expect ( health . size ) . toBe ( 2 ) ;
203204 expect ( health . oldestEntry ) . toBe ( new Date ( '2023-01-01T00:00:00.000Z' ) . getTime ( ) ) ;
204205 } ) ;
206+
207+ test ( 'expects to handle empty cache health information' , ( ) => {
208+ const cache = new Cache < string > ( ) ;
209+ const health = cache . health ;
210+ expect ( health . size ) . toBe ( 0 ) ;
211+ } ) ;
205212 } ) ;
206213
207214 describe ( 'delete and clear' , ( ) => {
You can’t perform that action at this time.
0 commit comments