mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-05 03:08:40 +00:00
test: mock console implementation (#2363)
Co-authored-by: Kevin Barabash <kevinb@khanacademy.org>
This commit is contained in:
@@ -3879,19 +3879,19 @@ describe("Extending katex by new fonts and symbols", function() {
|
||||
describe("debugging macros", () => {
|
||||
describe("message", () => {
|
||||
it("should print the argument using console.log", () => {
|
||||
jest.spyOn(console, "log");
|
||||
jest.spyOn(console, "log").mockImplementation();
|
||||
expect`\message{Hello, world}`.toParse();
|
||||
// eslint-disable-next-line no-console
|
||||
expect(console.log.mock.calls[0][0]).toEqual("Hello, world");
|
||||
expect(console.log).toHaveBeenCalledWith("Hello, world");
|
||||
});
|
||||
});
|
||||
|
||||
describe("errmessage", () => {
|
||||
it("should print the argument using console.error", () => {
|
||||
jest.spyOn(console, "error");
|
||||
jest.spyOn(console, "error").mockImplementation();
|
||||
expect`\errmessage{Hello, world}`.toParse();
|
||||
// eslint-disable-next-line no-console
|
||||
expect(console.error.mock.calls[0][0]).toEqual("Hello, world");
|
||||
expect(console.error).toHaveBeenCalledWith("Hello, world");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user