From eb8922dc64f9fca72df17957160e59570971286f Mon Sep 17 00:00:00 2001 From: Matt Webb Date: Tue, 30 Aug 2022 08:33:43 -0700 Subject: [PATCH] Add Honeybadger configuration test --- src/index.test.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/index.test.ts b/src/index.test.ts index 74cc97cf..ec459b26 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,3 +1,4 @@ +import Honeybadger from '@honeybadger-io/js'; import { describe, expect, jest, test } from '@jest/globals'; import nock from 'nock'; import { Blob } from 'node-fetch'; @@ -65,4 +66,18 @@ describe('entrypoint', () => { expect(secondaryHostClient2.uploadBackup).toHaveBeenCalledTimes(1); expect(secondaryHostClient2.uploadBackup).toHaveBeenCalledWith(backupData); }); + + describe('Honeybadger', () => { + test('to be configured', async () => { + const honeybadgerApiKey = jest + .spyOn(Config, 'honeybadgerApiKey', 'get') + .mockReturnValue('blablabla'); + const honeybadgerConfigure = jest.spyOn(Honeybadger, 'configure'); + + await expect(import('./index')).rejects.toBeDefined(); + + expect(honeybadgerApiKey).toHaveBeenCalled(); + expect(honeybadgerConfigure).toHaveBeenCalledWith({ apiKey: 'blablabla' }); + }); + }); });