-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Joe Reynolds
committed
Feb 12, 2019
1 parent
cdae9df
commit 9b8d6a1
Showing
2 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Printer } from "../../src/printer"; | ||
import { NullChecker } from "../../src/checker/nullChecker"; | ||
import { Query } from "../../src/reader/query"; | ||
import { SimpleFormat } from "../../src/formatter/formats/simple"; | ||
|
||
test("It gets the queries content when the verbose option is set", () => { | ||
const format = new SimpleFormat(); | ||
const checker = new NullChecker(); | ||
const query = new Query(); | ||
const getContentFn = (Query.prototype.getContent = jest.fn()); | ||
const printer = new Printer(1, format); | ||
printer.printCheck(checker, query, ""); | ||
expect(getContentFn).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
test("It calls console.log if a file is not found", () => { | ||
const console = jest.spyOn(global.console, 'log'); | ||
const format = new SimpleFormat(); | ||
const printer = new Printer(1, format); | ||
printer.warnAboutFileNotFound('some-file'); | ||
expect(console).toHaveBeenCalledTimes(1); | ||
}); |