[EC-515] Re-enable node consoleLog.service test (#3448)
This commit is contained in:
parent
04c594203c
commit
233c85f7a3
|
@ -1,32 +1,9 @@
|
|||
import { ConsoleLogService } from "@bitwarden/common/services/consoleLog.service";
|
||||
|
||||
const originalConsole = console;
|
||||
import { interceptConsole, restoreConsole } from "../shared/interceptConsole";
|
||||
|
||||
let caughtMessage: any;
|
||||
|
||||
declare let console: any;
|
||||
|
||||
export function interceptConsole(interceptions: any): object {
|
||||
console = {
|
||||
log: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.log = arguments;
|
||||
},
|
||||
warn: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.warn = arguments;
|
||||
},
|
||||
error: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.error = arguments;
|
||||
},
|
||||
};
|
||||
return interceptions;
|
||||
}
|
||||
|
||||
export function restoreConsole() {
|
||||
console = originalConsole;
|
||||
}
|
||||
|
||||
describe("ConsoleLogService", () => {
|
||||
let logService: ConsoleLogService;
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
const originalConsole = console;
|
||||
|
||||
declare let console: any;
|
||||
|
||||
export function interceptConsole(interceptions: any): object {
|
||||
console = {
|
||||
log: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.log = arguments;
|
||||
},
|
||||
warn: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.warn = arguments;
|
||||
},
|
||||
error: function () {
|
||||
// eslint-disable-next-line
|
||||
interceptions.error = arguments;
|
||||
},
|
||||
};
|
||||
return interceptions;
|
||||
}
|
||||
|
||||
export function restoreConsole() {
|
||||
console = originalConsole;
|
||||
}
|
|
@ -1,10 +1,7 @@
|
|||
import {
|
||||
interceptConsole,
|
||||
restoreConsole,
|
||||
} from "@bitwarden/common/../spec/services/consolelog.service.spec";
|
||||
|
||||
import { ConsoleLogService } from "@bitwarden/node/cli/services/consoleLog.service";
|
||||
|
||||
import { interceptConsole, restoreConsole } from "../../../common/spec/shared/interceptConsole";
|
||||
|
||||
let caughtMessage: any = {};
|
||||
|
||||
describe("CLI Console log service", () => {
|
Loading…
Reference in New Issue