File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -33,5 +33,25 @@ describe('cache', () => {
33
33
} ) ;
34
34
expect ( result ) . toEqual ( '771798e93f4fbad36b4c89cd88d3752383224caf8e585661dc174feb25939f75' ) ;
35
35
} ) ;
36
+
37
+ it ( 'returns a same hash uniquely representing the params when body has different order' , async ( ) => {
38
+ let params = {
39
+ method : 'POST' ,
40
+ path : '/v1/completions' ,
41
+ authHeader : null ,
42
+ body : '{"key1":"1","key2":"2"}' ,
43
+ } ;
44
+ let result = await getCacheKey ( params ) ;
45
+ expect ( result ) . toEqual ( '91b1af0c3f20778905ab588460bcb1d14b4621445f32fd871d7fe23056142923' ) ;
46
+
47
+ params = {
48
+ method : 'POST' ,
49
+ path : '/v1/completions' ,
50
+ authHeader : null ,
51
+ body : '{"key2":"2","key1":"1"}' ,
52
+ } ;
53
+ result = await getCacheKey ( params ) ;
54
+ expect ( result ) . toEqual ( '91b1af0c3f20778905ab588460bcb1d14b4621445f32fd871d7fe23056142923' ) ;
55
+ } ) ;
36
56
} ) ;
37
57
} ) ;
You can’t perform that action at this time.
0 commit comments