Skip to content

Commit

Permalink
fix: fix the file path and throw error if the file not found
Browse files Browse the repository at this point in the history
Signed-off-by: frank-zsy <[email protected]>
  • Loading branch information
frank-zsy committed Oct 9, 2023
1 parent c00e22d commit dccf8a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function validateData(
subFileName: string,
dataKey: string
) {
const fileName = `../test/testdata1/${subFileName}/${dataKey}.json`;
const fileName = `test/testdata/${subFileName}/${dataKey}.json`;

if (fs.existsSync(fileName)) {
const jsonData = JSON.parse(fs.readFileSync(fileName).toString());
Expand All @@ -34,6 +34,8 @@ async function validateData(
console.log("data2:", JSON.stringify(data2WithoutDetail));
}
assert(equal);
} else {
throw new Error(`File not found ${fileName}`);
}
}

Expand Down Expand Up @@ -313,4 +315,4 @@ describe("Data tests", () => {
} catch (err) {
console.error(err);
}
});
});

0 comments on commit dccf8a0

Please sign in to comment.