Skip to content

Commit 892ec12

Browse files
committed
Make changes in response to review
1 parent b3fcd16 commit 892ec12

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/collections/config/unit.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { MergeWithExisting } from './classes';
88
import { GenerativeCohereConfig, RerankerCohereConfig } from './types';
99

1010
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));
1212

1313
const invertedIndex: WeaviateInvertedIndexConfig = {
1414
bm25: {
@@ -66,7 +66,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
6666
};
6767

6868
it('should merge a full invertedIndexUpdate with existing schema', () => {
69-
const merged = MergeWithExisting.invertedIndex(parse(invertedIndex), {
69+
const merged = MergeWithExisting.invertedIndex(deepCopy(invertedIndex), {
7070
bm25: {
7171
b: 0.9,
7272
k1: 1.4,
@@ -139,7 +139,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
139139
};
140140

141141
it('should merge a partial invertedIndexUpdate with existing schema', () => {
142-
const merged = MergeWithExisting.invertedIndex(parse(invertedIndex), {
142+
const merged = MergeWithExisting.invertedIndex(deepCopy(invertedIndex), {
143143
bm25: {
144144
b: 0.9,
145145
},
@@ -163,7 +163,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
163163
});
164164

165165
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), [
167167
{
168168
name: 'name',
169169
vectorIndex: {
@@ -212,7 +212,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
212212
});
213213

214214
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), [
216216
{
217217
name: 'name',
218218
vectorIndex: {
@@ -261,7 +261,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
261261
});
262262

263263
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), [
265265
{
266266
name: 'name',
267267
vectorIndex: {
@@ -296,7 +296,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
296296
});
297297

298298
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), [
300300
{
301301
name: 'name',
302302
vectorIndex: {
@@ -333,7 +333,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
333333
});
334334

335335
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), [
337337
{
338338
name: 'name',
339339
vectorIndex: {
@@ -369,7 +369,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
369369
});
370370

371371
it('should merge full multi tenancy config with existing schema', () => {
372-
const merged = MergeWithExisting.multiTenancy(parse(multiTenancyConfig), {
372+
const merged = MergeWithExisting.multiTenancy(deepCopy(multiTenancyConfig), {
373373
autoTenantActivation: true,
374374
autoTenantCreation: true,
375375
});
@@ -381,7 +381,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
381381
});
382382

383383
it('should merge a generative config with existing schema', () => {
384-
const merged = MergeWithExisting.generative(parse(moduleConfig), {
384+
const merged = MergeWithExisting.generative(deepCopy(moduleConfig), {
385385
name: 'generative-cohere',
386386
config: {
387387
kProperty: 0.2,
@@ -397,7 +397,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
397397
});
398398

399399
it('should merge a reranker config with existing schema', () => {
400-
const merged = MergeWithExisting.reranker(parse(moduleConfig), {
400+
const merged = MergeWithExisting.reranker(deepCopy(moduleConfig), {
401401
name: 'reranker-cohere',
402402
config: {
403403
model: 'other',

0 commit comments

Comments
 (0)