Skip to content

Commit b6ed2ce

Browse files
committed
Misc rename
1 parent d3efd11 commit b6ed2ce

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

tests/search.test.ts

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -434,23 +434,20 @@ test.concurrent(`${federatedMultiSearch.name} method`, async () => {
434434
assert.deepEqual(facetStats, stats);
435435
});
436436

437-
// TODO:
438-
function assertSomething(hits: SearchHit<Film>[]) {
439-
for (const { _vectors } of hits) {
440-
assert.lengthOf(Object.keys(_vectors), 1);
441-
const {
442-
default: { embeddings, ...restOfObj },
443-
} = _vectors as Record<string, ExplicitVectors>;
444-
445-
for (const embedding of embeddings) {
446-
assert(Array.isArray(embedding));
447-
for (const embeddingElement of embedding) {
448-
assert.typeOf(embeddingElement, "number");
449-
}
437+
function assertIsVectors(vectors: SearchHit<Film>["_vectors"]) {
438+
assert.lengthOf(Object.keys(vectors), 1);
439+
const {
440+
default: { embeddings, ...restOfObj },
441+
} = vectors as Record<string, ExplicitVectors>;
442+
443+
for (const embedding of embeddings) {
444+
assert(Array.isArray(embedding), "expected embedding to be array");
445+
for (const embeddingElement of embedding) {
446+
assert.typeOf(embeddingElement, "number");
450447
}
451-
452-
assert.deepEqual(restOfObj, { regenerate: false });
453448
}
449+
450+
assert.deepEqual(restOfObj, { regenerate: false });
454451
}
455452

456453
describe.concurrent("embedding related params", () => {
@@ -467,7 +464,10 @@ describe.concurrent("embedding related params", () => {
467464
const { semanticHitCount, hits } = await searchMethod(params);
468465

469466
assert.typeOf(semanticHitCount, "number");
470-
assertSomething(hits);
467+
468+
for (const hit of hits) {
469+
assertIsVectors(hit._vectors);
470+
}
471471
},
472472
);
473473

@@ -477,7 +477,9 @@ describe.concurrent("embedding related params", () => {
477477
const { retrieveVectors } = params;
478478
const { hits } = await searchMethod({ retrieveVectors });
479479

480-
assertSomething(hits);
480+
for (const hit of hits) {
481+
assertIsVectors(hit._vectors);
482+
}
481483
},
482484
);
483485
});

0 commit comments

Comments
 (0)