Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
28 lines
1.1 KiB
Plaintext
28 lines
1.1 KiB
Plaintext
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var logger_1 = require("../logger");
|
|
describe('logger', function () {
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
var infoSpy;
|
|
beforeEach(function () {
|
|
infoSpy = jest.spyOn(console, 'info').mockImplementation(function () {
|
|
// do nothing
|
|
});
|
|
});
|
|
afterEach(function () {
|
|
infoSpy.mockRestore();
|
|
});
|
|
it('should call console.info when logger enabled', function () {
|
|
var id = Math.random().toString();
|
|
var logger = new logger_1.Logger({ id: id, enabled: true });
|
|
logger.info('testing');
|
|
expect(infoSpy).toHaveBeenLastCalledWith(id, expect.stringMatching(/\d+ms/), 'testing');
|
|
});
|
|
it("shouldn't call console.info when logger disabled", function () {
|
|
var id = Math.random().toString();
|
|
var logger = new logger_1.Logger({ id: id, enabled: false });
|
|
logger.info('testing');
|
|
expect(infoSpy).not.toHaveBeenCalled();
|
|
});
|
|
});
|
|
//# sourceMappingURL=logger.js.map |