From 6f71eb31e457eb0bed92d5a0251cf441501b5b58 Mon Sep 17 00:00:00 2001 From: Isla Koenigsknecht Date: Fri, 10 May 2024 17:42:10 -0400 Subject: [PATCH] Fix tests --- .../functions/storybookLog/storybookLog.test.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/state-manager/src/utils/functions/storybookLog/storybookLog.test.ts b/packages/state-manager/src/utils/functions/storybookLog/storybookLog.test.ts index 670ea63970..b7d487af6a 100644 --- a/packages/state-manager/src/utils/functions/storybookLog/storybookLog.test.ts +++ b/packages/state-manager/src/utils/functions/storybookLog/storybookLog.test.ts @@ -1,10 +1,11 @@ +import { QuietLogger } from '@quiet/logger' import { storybookLog } from './storybookLog.function' describe('storybookLog function', () => { const consoleLogMessage = 'storybookLog called' beforeEach(() => { - jest.spyOn(console, 'info') + jest.spyOn(QuietLogger.prototype, 'info') }) afterEach(() => { @@ -20,17 +21,17 @@ describe('storybookLog function', () => { it('should call `logger.info` with passed message', () => { storybookLog(consoleLogMessage)() - expect(console.info).toHaveBeenCalledWith(consoleLogMessage) - expect(console.info).toHaveBeenCalledTimes(1) + expect(QuietLogger.prototype.info).toHaveBeenCalledWith(consoleLogMessage) + expect(QuietLogger.prototype.info).toHaveBeenCalledTimes(1) }) - it('should call `console.info` with passed args', () => { + it('should call `logger.info` with passed args', () => { const args = ['something', 5] storybookLog(consoleLogMessage)(...args) - expect(console.info).toHaveBeenCalledWith(consoleLogMessage) - expect(console.info).toHaveBeenCalledWith(args[0]) - expect(console.info).toHaveBeenCalledWith(args[1]) - expect(console.info).toHaveBeenCalledTimes(3) + expect(QuietLogger.prototype.info).toHaveBeenCalledWith(consoleLogMessage) + expect(QuietLogger.prototype.info).toHaveBeenCalledWith(args[0]) + expect(QuietLogger.prototype.info).toHaveBeenCalledWith(args[1]) + expect(QuietLogger.prototype.info).toHaveBeenCalledTimes(3) }) })