UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

38 lines (32 loc) 800 B
import { describe, test, beforeEach, jest, expect } from '@jest/globals'; import initAPMService from './apm.js'; import { type LogService } from 'common-services'; describe('APM service', () => { const log = jest.fn<LogService>(); beforeEach(() => { log.mockReset(); }); test('should work', async () => { const apm = await initAPMService({ log }); apm('CALL', { id: 'call_id', }); expect({ logCalls: log.mock.calls.filter(([type]) => !type.endsWith('stack')), }).toMatchInlineSnapshot(` { "logCalls": [ [ "debug", "❤️ - Initializing the APM service.", ], [ "info", "CALL", "{"id":"call_id"}", ], ], } `); }); });