1- /* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */
1+
22import { expect , test } from 'vitest' ;
33import { Keyv } from 'keyv' ;
44import { faker } from '@faker-js/faker' ;
@@ -32,7 +32,7 @@ test('should set a new ttl when secondary is setting primary', async () => {
3232 const primaryResult2 = await cacheable . primary . get ( data . key , { raw : true } ) ;
3333 expect ( primaryResult2 ?. value ) . toEqual ( data . value ) ;
3434
35- const ttlFromExpires = getTtlFromExpires ( primaryResult2 ?. expires as number | undefined ) ;
35+ const ttlFromExpires = getTtlFromExpires ( primaryResult2 ?. expires ) ;
3636 expect ( ttlFromExpires ) . toBeLessThan ( 12 ) ;
3737
3838 // Now make sure that it expires after 10 seconds
@@ -64,7 +64,7 @@ test('should use the cacheable default ttl on secondary -> primary', async () =>
6464 const primaryResult = await cacheable . primary . get ( data . key , { raw : true } ) ;
6565 expect ( primaryResult ?. value ) . toEqual ( data . value ) ;
6666
67- const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires as number | undefined ) ;
67+ const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires ) ;
6868 expect ( ttlFromExpires ) . toBeGreaterThan ( 95 ) ;
6969 expect ( ttlFromExpires ) . toBeLessThan ( 105 ) ;
7070} ) ;
@@ -89,7 +89,7 @@ test('should use the primary ttl on secondary -> primary', async () => {
8989 const primaryResult = await cacheable . primary . get ( data . key , { raw : true } ) ;
9090 expect ( primaryResult ?. value ) . toEqual ( data . value ) ;
9191
92- const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires as number | undefined ) ;
92+ const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires ) ;
9393 expect ( ttlFromExpires ) . toBeGreaterThan ( 45 ) ;
9494 expect ( ttlFromExpires ) . toBeLessThan ( 55 ) ;
9595} ) ;
@@ -114,7 +114,7 @@ test('should use the secondary ttl on secondary -> primary', async () => {
114114 const primaryResult = await cacheable . primary . get ( data . key , { raw : true } ) ;
115115 expect ( primaryResult ?. value ) . toEqual ( data . value ) ;
116116
117- const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires as number | undefined ) ;
117+ const ttlFromExpires = getTtlFromExpires ( primaryResult ?. expires ) ;
118118 expect ( ttlFromExpires ) . toBeGreaterThan ( 45 ) ;
119119 expect ( ttlFromExpires ) . toBeLessThan ( 55 ) ;
120120} ) ;
0 commit comments