Skip to content

Commit

Permalink
Fixing issue with false positives #40 (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
hansson authored and stofolus committed Apr 14, 2019
1 parent f46e26b commit 70b6872
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion integration/mockdata/test2/data/data.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
19121212-1212
19121212-1212
20180107-2396
5 changes: 4 additions & 1 deletion lib/finder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ class Finder {
} else {
files.push(searchPath);
}
const validator = new Validator([...[FileMockDataReader.fetch()], ...[WhitelistReader.fetch(searchPath)]]);
const validator = new Validator([
...FileMockDataReader.fetch(),
...WhitelistReader.fetch(searchPath)
]);

return files
.map(file => {
Expand Down
5 changes: 4 additions & 1 deletion lib/finder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ const mockIsTextOrBinary = {
const mockValidator = {
isMock: pnr => pnr === "195309112489"
};
const mockFileMockDataReader = {
fetch: () => ["195309112489"]
};
jest.doMock("glob", () => mockGlob);
jest.mock("fs", () => mockFs);
jest.mock("istextorbinary", () => mockIsTextOrBinary);
jest.mock("./validator", () => {
return jest.fn().mockImplementation(() => mockValidator);
});
jest.mock("./fileMockDataReader");
jest.mock("./fileMockDataReader", () => mockFileMockDataReader);

const Finder = require("./finder");

Expand Down

0 comments on commit 70b6872

Please sign in to comment.