11import { RenderVariant } from '../../../models/src' ;
2- import { getCacheKey } from './cache-utils' ;
2+ import { defaultCacheKeyGenerator } from './cache-utils' ;
33
44describe ( 'getCacheKey' , ( ) => {
55 it ( 'should return the URL without query parameters when none are allowed' , ( ) => {
66 const url = '/page?param1=value1¶m2=value2' ;
7- const result = getCacheKey ( url , [ ] , null ) ;
7+ const result = defaultCacheKeyGenerator ( url , [ ] , null ) ;
88 expect ( result ) . toBe ( '/page' ) ;
99 } ) ;
1010
1111 it ( 'should return the URL with query parameters when it is null or undefined' , ( ) => {
1212 const url = '/page?param1=value1¶m2=value2' ;
13- const result = getCacheKey ( url , null , null ) ;
13+ const result = defaultCacheKeyGenerator ( url , null , null ) ;
1414 expect ( result ) . toBe ( '/page?param1=value1¶m2=value2' ) ;
1515 } ) ;
1616
1717 it ( 'should include only allowed query parameters in the result' , ( ) => {
1818 const url = '/page?allowed=value&disallowed=value' ;
19- const result = getCacheKey ( url , [ 'allowed' ] , null ) ;
19+ const result = defaultCacheKeyGenerator ( url , [ 'allowed' ] , null ) ;
2020 expect ( result ) . toBe ( '/page?allowed=value' ) ;
2121 } ) ;
2222
2323 it ( 'should exclude disallowed query parameters' , ( ) => {
2424 const url = '/page?allowed=value&disallowed=value' ;
25- const result = getCacheKey ( url , [ 'allowed' ] , null ) ;
25+ const result = defaultCacheKeyGenerator ( url , [ 'allowed' ] , null ) ;
2626 expect ( result ) . not . toContain ( 'disallowed=value' ) ;
2727 } ) ;
2828
@@ -32,7 +32,7 @@ describe('getCacheKey', () => {
3232 identifier : 'variant123' ,
3333 detectVariant : ( ) => true ,
3434 } ;
35- const result = getCacheKey ( url , [ 'param' ] , variant ) ;
35+ const result = defaultCacheKeyGenerator ( url , [ 'param' ] , variant ) ;
3636 expect ( result ) . toBe ( '/page?param=value<variantId:variant123>' ) ;
3737 } ) ;
3838} ) ;
0 commit comments