Skip to content

Commit

Permalink
fix(App): Add fake lofger to tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Awalgawe committed Mar 21, 2021
1 parent 2a63f4e commit e6ed078
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('App', () => {
it.only('should throws', async () => {
// Arrange
const error = new Error("An API error occurred: something's wrong");
const fakeLogger = createFakeLogger();
const overrides = mergeOverrides(withNoopAppMetadata(), withUnsuccessfulBotUserFetchingWebClient(error));
const App = await importApp(overrides); // eslint-disable-line @typescript-eslint/naming-convention, no-underscore-dangle, id-blacklist, id-match
const event: ReceiverEvent = {
Expand All @@ -73,11 +74,13 @@ describe('App', () => {
};

// Act
const app = new App({ token: '', signingSecret: '' });
const app = new App({ token: '', signingSecret: '', logger: fakeLogger });

// Assert
assert.equal(await app.processEvent(event).catch((e) => e as Error), error);
assert.equal(await app.processEvent(event).catch((e) => e as Error), error); // retry
assert.equal(fakeLogger.warn.callCount, 2);
assert.equal(fakeLogger.error.callCount, 2);
});
});
it('should succeed with an authorize callback', async () => {
Expand Down

0 comments on commit e6ed078

Please sign in to comment.