Files
hoppscotch/packages/hoppscotch-cli/src/__tests__/functions/collection/collectionsRunnerResult.spec.ts
Deepanshu Dhruw 432337b801 chore: tests for hoppscotch-cli (#2300)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
2022-05-11 15:44:19 +05:30

36 lines
857 B
TypeScript

import { collectionsRunnerResult } from "../../../utils/collections";
const FALSE_RESULT_REPORT = {
path: "some_path",
tests: [],
errors: [],
result: false,
duration: { test: 1, request: 1, preRequest: 1 },
};
const TRUE_RESULT_REPORT = {
path: "some_path",
tests: [],
errors: [],
result: true,
duration: { test: 1, request: 1, preRequest: 1 },
};
describe("collectionsRunnerResult", () => {
test("Empty request-report.", () => {
expect(collectionsRunnerResult([])).toBeTruthy();
});
test("Atleast 1 false result in request-report.", () => {
expect(
collectionsRunnerResult([FALSE_RESULT_REPORT, TRUE_RESULT_REPORT])
).toBeFalsy();
});
test("All true result(s) in request-report.", () => {
expect(
collectionsRunnerResult([TRUE_RESULT_REPORT, TRUE_RESULT_REPORT])
).toBeTruthy();
});
});