Skip to content

Commit

Permalink
fix: Types on api_test
Browse files Browse the repository at this point in the history
  • Loading branch information
ff6347 committed Nov 30, 2023
1 parent 0ce4609 commit 7ec02cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/api_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "fs";

import type { DocumentSearchResponse } from "../src/lib/common.js";
enum Algorithms {
ChunksAndSummaries = "chunks-and-summaries",
ChunksOnly = "chunks-only",
Expand Down Expand Up @@ -48,7 +48,7 @@ interface AlgorithmCount {
count: number;
}

let counts: Array<AlgorithmCount> = availableAlgorithms.map((alg) => {
const counts: Array<AlgorithmCount> = availableAlgorithms.map((alg) => {
return { algorithm: alg.search_algorithm, count: 0 } as AlgorithmCount;
});

Expand All @@ -72,10 +72,10 @@ for (let algIdx = 0; algIdx < availableAlgorithms.length; algIdx++) {
},
body: JSON.stringify({ ...algorithm, query: question }),
});
const res = await data.json();
const res = (await data.json()) as DocumentSearchResponse;

if (res.documentMatches) {
const foundDocument = res.documentMatches.filter((d: any) => {
const foundDocument = res.documentMatches.filter((d) => {
return d.registered_document.source_url.includes(groundTruthUrl);
})[0];
if (foundDocument) {
Expand All @@ -101,7 +101,7 @@ for (let algIdx = 0; algIdx < availableAlgorithms.length; algIdx++) {
console.log(`Tests completed for ${algorithm.search_algorithm}....\n\n`);
}

console.log(`All tests completed, summary:`);
console.log("All tests completed, summary:");
counts.forEach((c) => {
console.log(
`Algorithm "${c.algorithm}" has match rate = ${(
Expand Down

0 comments on commit 7ec02cd

Please # to comment.