Skip to content

Commit 9d27f2f

Browse files
committed
Rearrange parse method
1 parent af87430 commit 9d27f2f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/collections/config/unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ 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));
12+
1113
const invertedIndex: WeaviateInvertedIndexConfig = {
1214
bm25: {
1315
b: 0.8,
@@ -64,7 +66,7 @@ describe('Unit testing of the MergeWithExisting class', () => {
6466
};
6567

6668
it('should merge a full invertedIndexUpdate with existing schema', () => {
67-
const merged = MergeWithExisting.invertedIndex(JSON.parse(JSON.stringify(invertedIndex)), {
69+
const merged = MergeWithExisting.invertedIndex(parse(invertedIndex), {
6870
bm25: {
6971
b: 0.9,
7072
k1: 1.4,
@@ -136,8 +138,6 @@ describe('Unit testing of the MergeWithExisting class', () => {
136138
'reranker-cohere': {},
137139
};
138140

139-
const parse = (config: any) => JSON.parse(JSON.stringify(config));
140-
141141
it('should merge a partial invertedIndexUpdate with existing schema', () => {
142142
const merged = MergeWithExisting.invertedIndex(parse(invertedIndex), {
143143
bm25: {
@@ -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(JSON.parse(JSON.stringify(flatVectorConfig)), [
336+
const merged = MergeWithExisting.vectors(parse(flatVectorConfig), [
337337
{
338338
name: 'name',
339339
vectorIndex: {

0 commit comments

Comments
 (0)