Skip to content

Commit a906b19

Browse files
committed
Increase coverage
1 parent cad918f commit a906b19

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

jest.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ module.exports = {
77
coveragePathIgnorePatterns: [".test-d.ts"],
88
coverageThreshold: {
99
global: {
10-
statements: 98,
11-
branches: 86,
10+
statements: 99,
11+
branches: 87,
1212
functions: 100,
13-
lines: 98,
13+
lines: 99,
1414
},
1515
},
1616
};

src/processors.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ import {
1515
import { postprocessArguments } from "./__fixtures__/postprocessArguments";
1616

1717
const [messages, filename] = postprocessArguments;
18+
const untrackedFilename = "an-untracked-file.js";
1819

1920
const gitMocked: jest.MockedObjectDeep<typeof git> = jest.mocked(git);
2021
gitMocked.getDiffFileList.mockReturnValue([filename]);
21-
gitMocked.getUntrackedFileList.mockReturnValue([]);
22+
gitMocked.getUntrackedFileList.mockReturnValue([untrackedFilename]);
2223

2324
describe("processors", () => {
2425
it("preprocess (diff and staged)", async () => {
@@ -53,6 +54,20 @@ describe("processors", () => {
5354
);
5455
});
5556

57+
it("diff postprocess for untracked files with messages", async () => {
58+
gitMocked.getDiffForFile.mockReturnValue(fixtureDiff);
59+
60+
const { staged: stagedProcessors } = await import("./processors");
61+
62+
const untrackedFilesMessages: Linter.LintMessage[] = [
63+
{ ruleId: "mock", severity: 1, message: "mock msg", line: 1, column: 1 },
64+
];
65+
66+
expect(
67+
stagedProcessors.postprocess([untrackedFilesMessages], untrackedFilename)
68+
).toEqual(untrackedFilesMessages);
69+
});
70+
5671
it("staged postprocess", async () => {
5772
gitMocked.hasCleanIndex.mockReturnValueOnce(true);
5873
gitMocked.getDiffForFile.mockReturnValueOnce(fixtureStaged);

0 commit comments

Comments
 (0)