@@ -18,71 +18,30 @@ describe('VINFO', () => {
1818
1919 const result = await client . vInfo ( 'key' ) ;
2020 assert . ok ( typeof result === 'object' && result !== null ) ;
21-
22- assert . equal ( result [ 'vector-dim' ] , 3 ) ;
23- assert . equal ( result [ 'size' ] , 1 ) ;
24- assert . ok ( 'quant-type' in result ) ;
25- assert . ok ( 'hnsw-m' in result ) ;
26- assert . ok ( 'projection-input-dim' in result ) ;
27- assert . ok ( 'max-level' in result ) ;
28- assert . ok ( 'attributes-count' in result ) ;
29- assert . ok ( 'vset-uid' in result ) ;
30- assert . ok ( 'hnsw-max-node-uid' in result ) ;
31- } , {
32- client : { ...GLOBAL . SERVERS . OPEN , minimumDockerVersion : [ 8 , 0 ] } ,
33- cluster : { ...GLOBAL . CLUSTERS . OPEN , minimumDockerVersion : [ 8 , 0 ] }
34- } ) ;
35-
36- testUtils . testWithClient ( 'vInfo structural assertion (RESP2)' , async client => {
37- await client . vAdd ( 'key' , [ 1.0 , 2.0 , 3.0 ] , 'element' ) ;
38-
39- const result = await client . vInfo ( 'key' ) ;
40-
41- // Structural assertion: ensure all expected keys exist and have correct types
42- assert . ok ( typeof result === 'object' && result !== null ) ;
43- assert . ok ( 'quant-type' in result ) ;
44- assert . equal ( typeof result [ 'quant-type' ] , 'string' ) ;
45- assert . ok ( 'vector-dim' in result ) ;
46- assert . equal ( typeof result [ 'vector-dim' ] , 'number' ) ;
47- assert . equal ( result [ 'vector-dim' ] , 3 ) ;
48- assert . ok ( 'size' in result ) ;
49- assert . equal ( typeof result [ 'size' ] , 'number' ) ;
50- assert . equal ( result [ 'size' ] , 1 ) ;
51- assert . ok ( 'max-level' in result ) ;
52- assert . equal ( typeof result [ 'max-level' ] , 'number' ) ;
53- assert . ok ( 'vset-uid' in result ) ;
54- assert . equal ( typeof result [ 'vset-uid' ] , 'number' ) ;
55- assert . ok ( 'hnsw-max-node-uid' in result ) ;
56- assert . equal ( typeof result [ 'hnsw-max-node-uid' ] , 'number' ) ;
57-
58- // Verify it's a plain object (RESP2 transformation result), not an array or Map
59- assert . equal ( Object . getPrototypeOf ( result ) , null ) ;
6021 assert . equal ( Array . isArray ( result ) , false ) ;
61- } , {
62- ...GLOBAL . SERVERS . OPEN ,
63- minimumDockerVersion : [ 8 , 0 ]
64- } ) ;
22+ assert . equal ( result instanceof Map , false ) ;
23+
24+ const expectedKeys = [
25+ 'quant-type' ,
26+ 'hnsw-m' ,
27+ 'vector-dim' ,
28+ 'projection-input-dim' ,
29+ 'size' ,
30+ 'max-level' ,
31+ 'attributes-count' ,
32+ 'vset-uid' ,
33+ 'hnsw-max-node-uid'
34+ ] ;
6535
66- testUtils . testWithClient ( 'vInfo with RESP3' , async client => {
67- await client . vAdd ( 'resp3-key' , [ 1.0 , 2.0 , 3.0 ] , 'resp3-element' ) ;
68-
69- const result = await client . vInfo ( 'resp3-key' ) ;
70- assert . ok ( typeof result === 'object' && result !== null ) ;
36+ assert . deepEqual (
37+ Object . keys ( result ) . sort ( ) ,
38+ expectedKeys . sort ( )
39+ ) ;
7140
7241 assert . equal ( result [ 'vector-dim' ] , 3 ) ;
7342 assert . equal ( result [ 'size' ] , 1 ) ;
74- assert . ok ( 'quant-type' in result ) ;
75- assert . ok ( 'hnsw-m' in result ) ;
76- assert . ok ( 'projection-input-dim' in result ) ;
77- assert . ok ( 'max-level' in result ) ;
78- assert . ok ( 'attributes-count' in result ) ;
79- assert . ok ( 'vset-uid' in result ) ;
80- assert . ok ( 'hnsw-max-node-uid' in result ) ;
8143 } , {
82- ...GLOBAL . SERVERS . OPEN ,
83- clientOptions : {
84- RESP : 3
85- } ,
86- minimumDockerVersion : [ 8 , 0 ]
44+ client : { ...GLOBAL . SERVERS . OPEN , minimumDockerVersion : [ 8 , 0 ] } ,
45+ cluster : { ...GLOBAL . CLUSTERS . OPEN , minimumDockerVersion : [ 8 , 0 ] }
8746 } ) ;
8847} ) ;
0 commit comments