Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚨 test(event-handler-test): add missing done() callback to make async test to wait until all expect #195

Merged
merged 1 commit into from
Aug 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions test/integration/event-handler-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { createEventHandler } from "../../src/event-handler";
import pushEventPayload from "../fixtures/push-payload.json";
import installationCreatedPayload from "../fixtures/installation-created-payload.json";

test("events", (t) => {
// expect.assertions(7);

test("events", (done) => {
const eventHandler = createEventHandler({});

const hooksCalled = [];
Expand Down Expand Up @@ -97,10 +95,11 @@ test("events", (t) => {
);
})

.catch((e) => expect(e instanceof Error).toBeTruthy());
.catch((e) => expect(e instanceof Error).toBeTruthy())
.finally(done);
});

test("options.transform", (t) => {
test("options.transform", (done) => {
expect.assertions(2);

const eventHandler = createEventHandler({
Expand All @@ -112,6 +111,8 @@ test("options.transform", (t) => {

eventHandler.on("push", (event) => {
expect(event).toBe("funky");

done();
});

eventHandler.receive({
Expand Down Expand Up @@ -140,7 +141,7 @@ test("async options.transform", (done) => {
});
});

test("multiple errors in same event handler", (t) => {
test("multiple errors in same event handler", (done) => {
expect.assertions(2);

const eventHandler = createEventHandler({});
Expand All @@ -165,5 +166,6 @@ test("multiple errors in same event handler", (t) => {
expect(Array.from(error).length).toBe(2);
})

.catch((e) => expect(e instanceof Error).toBeTruthy());
.catch((e) => expect(e instanceof Error).toBeTruthy())
.finally(done);
});