Skip to content
This repository was archived by the owner on May 4, 2023. It is now read-only.

Commit 6a4af0e

Browse files
feat: output tests
1 parent 655c9f5 commit 6a4af0e

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
*/
55

66
module.exports = {
7+
moduleNameMapper: {
8+
"^csv-stringify/dist/esm/sync":
9+
"<rootDir>/node_modules/csv-stringify/dist/cjs/sync",
10+
},
711
// All imported modules in your tests should be mocked automatically
812
// automock: false,
913

tests/output.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { formatAnalysis } from "../utils/output";
2+
import {
3+
violationsMock,
4+
violationsText,
5+
violationsJson,
6+
violationsCsv,
7+
} from "./fixtures/violationsMock";
8+
9+
describe("output.test.js", () => {
10+
test("should check text format", async () => {
11+
const content = await formatAnalysis(violationsMock, "text");
12+
expect(content).toBe(violationsText);
13+
});
14+
15+
test("should check json format", async () => {
16+
const content = await formatAnalysis(violationsMock, "json");
17+
expect(content).toBe(violationsJson);
18+
});
19+
20+
test("should check csv format", async () => {
21+
const content = await formatAnalysis(violationsMock, "csv");
22+
expect(content).toBe(violationsCsv);
23+
});
24+
});

0 commit comments

Comments
 (0)