From 45c0c34f8b784cdb2bb75eabe9858853cab1a086 Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Mon, 18 Mar 2024 15:42:06 -0700 Subject: [PATCH] apply suggestions --- .../__tests__/BackgroundProcessManager.test.ts | 2 +- packages/core/__tests__/ConsoleLogger.test.ts | 15 +++++++++------ .../__tests__/clients/composeApiHandler.test.ts | 8 ++++---- .../queuedStorage/queuedStorage.native.test.ts | 5 ----- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/packages/core/__tests__/BackgroundProcessManager.test.ts b/packages/core/__tests__/BackgroundProcessManager.test.ts index 75fa2bbc1e0..9b83e0b01fb 100644 --- a/packages/core/__tests__/BackgroundProcessManager.test.ts +++ b/packages/core/__tests__/BackgroundProcessManager.test.ts @@ -428,7 +428,7 @@ describe('BackgroundProcessManager', () => { const manager = new BackgroundProcessManager(); let count = 0; - const _ = new Observable(observer => { + new Observable(observer => { const interval = setInterval(() => { observer.next({}); }, 10); diff --git a/packages/core/__tests__/ConsoleLogger.test.ts b/packages/core/__tests__/ConsoleLogger.test.ts index 41b31cf0815..0025f29ab71 100644 --- a/packages/core/__tests__/ConsoleLogger.test.ts +++ b/packages/core/__tests__/ConsoleLogger.test.ts @@ -1,15 +1,18 @@ import { ConsoleLogger } from '../src'; -import { LoggingProvider, LogType } from '../src/Logger/types'; +import { LogType, LoggingProvider } from '../src/Logger/types'; type LogEvent = 'verbose' | 'debug' | 'info' | 'warn' | 'error'; describe('ConsoleLogger', () => { + const noop = () => { + // no op + }; beforeAll(() => { - jest.spyOn(console, 'log').mockImplementation(() => {}); - jest.spyOn(console, 'error').mockImplementation(() => {}); - jest.spyOn(console, 'warn').mockImplementation(() => {}); - jest.spyOn(console, 'info').mockImplementation(() => {}); - jest.spyOn(console, 'debug').mockImplementation(() => {}); + jest.spyOn(console, 'log').mockImplementation(noop); + jest.spyOn(console, 'error').mockImplementation(noop); + jest.spyOn(console, 'warn').mockImplementation(noop); + jest.spyOn(console, 'info').mockImplementation(noop); + jest.spyOn(console, 'debug').mockImplementation(noop); }); afterEach(() => { jest.clearAllMocks(); diff --git a/packages/core/__tests__/clients/composeApiHandler.test.ts b/packages/core/__tests__/clients/composeApiHandler.test.ts index eeaec7ec17b..9a31abbdac5 100644 --- a/packages/core/__tests__/clients/composeApiHandler.test.ts +++ b/packages/core/__tests__/clients/composeApiHandler.test.ts @@ -22,8 +22,8 @@ describe(composeServiceApi.name, () => { const mockTransferHandler = jest.fn().mockResolvedValue(defaultResponse); const api = composeServiceApi( mockTransferHandler, - _ => defaultRequest, - async _ => ({ + () => defaultRequest, + async () => ({ Result: 'from API', }), defaultConfig, @@ -47,8 +47,8 @@ describe(composeServiceApi.name, () => { }; const api = composeServiceApi( mockTransferHandler, - __ => defaultRequest, - async __ => ({ + () => defaultRequest, + async () => ({ Result: 'from API', }), defaultConfig, diff --git a/packages/core/__tests__/utils/queuedStorage/queuedStorage.native.test.ts b/packages/core/__tests__/utils/queuedStorage/queuedStorage.native.test.ts index 4bae7b803c2..80395206eb0 100644 --- a/packages/core/__tests__/utils/queuedStorage/queuedStorage.native.test.ts +++ b/packages/core/__tests__/utils/queuedStorage/queuedStorage.native.test.ts @@ -131,7 +131,6 @@ describe('createQueuedStorage', () => { describe('method add()', () => { let queuedStorage: QueuedStorage; - // let originalDate; let dateNowSpy: jest.SpyInstance; const testInput: ItemToAdd = { content: 'some log content', @@ -139,10 +138,6 @@ describe('createQueuedStorage', () => { }; beforeAll(() => { - // originalDate = Date; - // Date = { - // now: jest.fn(() => 123), - // } as any; dateNowSpy = jest.spyOn(Date, 'now').mockReturnValue(123); queuedStorage = createQueuedStorage(); });