feat: added support for passing env.json file to test cmd (#2373)

This commit is contained in:
Deepanshu Dhruw
2022-06-15 23:53:24 +05:30
committed by GitHub
parent 2d0bd48e00
commit 0244b941b3
20 changed files with 309 additions and 96 deletions

View File

@@ -0,0 +1,28 @@
import { HoppCLIError } from "../../../types/errors";
import { checkFile } from "../../../utils/checks";
import "@relmify/jest-fp-ts";
describe("checkFile", () => {
test("File doesn't exists.", () => {
return expect(
checkFile("./src/samples/this-file-not-exists.json")()
).resolves.toSubsetEqualLeft(<HoppCLIError>{
code: "FILE_NOT_FOUND",
});
});
test("File not of JSON type.", () => {
return expect(
checkFile("./src/__tests__/samples/notjson.txt")()
).resolves.toSubsetEqualLeft(<HoppCLIError>{
code: "INVALID_FILE_TYPE",
});
});
test("Existing JSON file.", () => {
return expect(
checkFile("./src/__tests__/samples/passes.json")()
).resolves.toBeRight();
});
});