mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-26 12:25:20 +01:00
a4fba0e1c5
* Switch to jest * Fix jslib-angular package name * Make angular test project * Split up tests by jslib project * Remove obsolete node test script * Use legacy deps with jest-preset-angular * Move web tests to common * Remove build from pipeline This was only being used because we were not using ts runners. We are now, so build is unnecessary
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import {
|
|
interceptConsole,
|
|
restoreConsole,
|
|
} from "jslib-common/../spec/services/consolelog.service.spec";
|
|
|
|
import { ConsoleLogService } from "jslib-node/cli/services/consoleLog.service";
|
|
|
|
let caughtMessage: any = {};
|
|
|
|
describe("CLI Console log service", () => {
|
|
let logService: ConsoleLogService;
|
|
beforeEach(() => {
|
|
caughtMessage = {};
|
|
interceptConsole(caughtMessage);
|
|
logService = new ConsoleLogService(true);
|
|
});
|
|
|
|
afterAll(() => {
|
|
restoreConsole();
|
|
});
|
|
|
|
it("should redirect all console to error if BW_RESPONSE env is true", () => {
|
|
process.env.BW_RESPONSE = "true";
|
|
|
|
logService.debug("this is a debug message");
|
|
expect(caughtMessage).toMatchObject({
|
|
error: { 0: "this is a debug message" },
|
|
});
|
|
});
|
|
|
|
it("should not redirect console to error if BW_RESPONSE != true", () => {
|
|
process.env.BW_RESPONSE = "false";
|
|
|
|
logService.debug("debug");
|
|
logService.info("info");
|
|
logService.warning("warning");
|
|
logService.error("error");
|
|
|
|
expect(caughtMessage).toMatchObject({
|
|
log: { 0: "info" },
|
|
warn: { 0: "warning" },
|
|
error: { 0: "error" },
|
|
});
|
|
});
|
|
});
|