@@ -8,7 +8,7 @@ import { MergeWithExisting } from './classes';
8
8
import { GenerativeCohereConfig , RerankerCohereConfig } from './types' ;
9
9
10
10
describe ( 'Unit testing of the MergeWithExisting class' , ( ) => {
11
- const parse = ( config : any ) => JSON . parse ( JSON . stringify ( config ) ) ;
11
+ const deepCopy = ( config : any ) => JSON . parse ( JSON . stringify ( config ) ) ;
12
12
13
13
const invertedIndex : WeaviateInvertedIndexConfig = {
14
14
bm25 : {
@@ -66,7 +66,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
66
66
} ;
67
67
68
68
it ( 'should merge a full invertedIndexUpdate with existing schema' , ( ) => {
69
- const merged = MergeWithExisting . invertedIndex ( parse ( invertedIndex ) , {
69
+ const merged = MergeWithExisting . invertedIndex ( deepCopy ( invertedIndex ) , {
70
70
bm25 : {
71
71
b : 0.9 ,
72
72
k1 : 1.4 ,
@@ -139,7 +139,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
139
139
} ;
140
140
141
141
it ( 'should merge a partial invertedIndexUpdate with existing schema' , ( ) => {
142
- const merged = MergeWithExisting . invertedIndex ( parse ( invertedIndex ) , {
142
+ const merged = MergeWithExisting . invertedIndex ( deepCopy ( invertedIndex ) , {
143
143
bm25 : {
144
144
b : 0.9 ,
145
145
} ,
@@ -163,7 +163,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
163
163
} ) ;
164
164
165
165
it ( 'should merge a no quantizer HNSW vectorIndexConfig with existing schema' , ( ) => {
166
- const merged = MergeWithExisting . vectors ( parse ( hnswVectorConfig ) , [
166
+ const merged = MergeWithExisting . vectors ( deepCopy ( hnswVectorConfig ) , [
167
167
{
168
168
name : 'name' ,
169
169
vectorIndex : {
@@ -212,7 +212,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
212
212
} ) ;
213
213
214
214
it ( 'should merge a PQ quantizer HNSW vectorIndexConfig with existing schema' , ( ) => {
215
- const merged = MergeWithExisting . vectors ( parse ( hnswVectorConfig ) , [
215
+ const merged = MergeWithExisting . vectors ( deepCopy ( hnswVectorConfig ) , [
216
216
{
217
217
name : 'name' ,
218
218
vectorIndex : {
@@ -261,7 +261,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
261
261
} ) ;
262
262
263
263
it ( 'should merge a BQ quantizer HNSW vectorIndexConfig with existing schema' , ( ) => {
264
- const merged = MergeWithExisting . vectors ( parse ( hnswVectorConfig ) , [
264
+ const merged = MergeWithExisting . vectors ( deepCopy ( hnswVectorConfig ) , [
265
265
{
266
266
name : 'name' ,
267
267
vectorIndex : {
@@ -296,7 +296,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
296
296
} ) ;
297
297
298
298
it ( 'should merge a SQ quantizer HNSW vectorIndexConfig with existing schema' , ( ) => {
299
- const merged = MergeWithExisting . vectors ( parse ( hnswVectorConfig ) , [
299
+ const merged = MergeWithExisting . vectors ( deepCopy ( hnswVectorConfig ) , [
300
300
{
301
301
name : 'name' ,
302
302
vectorIndex : {
@@ -333,7 +333,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
333
333
} ) ;
334
334
335
335
it ( 'should merge a BQ quantizer Flat vectorIndexConfig with existing schema' , ( ) => {
336
- const merged = MergeWithExisting . vectors ( parse ( flatVectorConfig ) , [
336
+ const merged = MergeWithExisting . vectors ( deepCopy ( flatVectorConfig ) , [
337
337
{
338
338
name : 'name' ,
339
339
vectorIndex : {
@@ -369,7 +369,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
369
369
} ) ;
370
370
371
371
it ( 'should merge full multi tenancy config with existing schema' , ( ) => {
372
- const merged = MergeWithExisting . multiTenancy ( parse ( multiTenancyConfig ) , {
372
+ const merged = MergeWithExisting . multiTenancy ( deepCopy ( multiTenancyConfig ) , {
373
373
autoTenantActivation : true ,
374
374
autoTenantCreation : true ,
375
375
} ) ;
@@ -381,7 +381,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
381
381
} ) ;
382
382
383
383
it ( 'should merge a generative config with existing schema' , ( ) => {
384
- const merged = MergeWithExisting . generative ( parse ( moduleConfig ) , {
384
+ const merged = MergeWithExisting . generative ( deepCopy ( moduleConfig ) , {
385
385
name : 'generative-cohere' ,
386
386
config : {
387
387
kProperty : 0.2 ,
@@ -397,7 +397,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
397
397
} ) ;
398
398
399
399
it ( 'should merge a reranker config with existing schema' , ( ) => {
400
- const merged = MergeWithExisting . reranker ( parse ( moduleConfig ) , {
400
+ const merged = MergeWithExisting . reranker ( deepCopy ( moduleConfig ) , {
401
401
name : 'reranker-cohere' ,
402
402
config : {
403
403
model : 'other' ,
0 commit comments