Skip to content

Commit

Permalink
fix failing tests on travis
Browse files Browse the repository at this point in the history
  • Loading branch information
MuhweziDeo committed Jun 15, 2020
1 parent 7488d8c commit 93652ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/api/users/__tests__/user.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { IRequest, userController } from "../user-controller";

export const mockUser = {id: 1, username: "dee", password: "random", email: "[email protected]"};

jest.mock("../../../helpers/email-helper", () => ({
sendPasswordResetEmail: jest.fn(),
}));
// TODO add supertest tests

describe("UserController", () => {
Expand Down
8 changes: 6 additions & 2 deletions src/events/__tests__/handlers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ import * as helpers from "../../helpers";
import {IAdminEmail} from "../../helpers/email-helper";
import { newAdminRegisteredHandler } from "../handlers";

jest.mock("../../helpers/email-helper.ts", () => ({
sendAdminConfirmationEmail: jest.fn(),
}));

describe("Handlers", () => {
it("should handle new admin registration event", async () => {
const data: IAdminEmail = {
email: "test@test",
username: "username",
addedBy: "me",
email: "test@test",
password: "password",
username: "username",
};
jest.spyOn(helpers, "sendAdminConfirmationEmail").mockResolvedValueOnce(null);
await newAdminRegisteredHandler(data);
Expand Down

0 comments on commit 93652ba

Please sign in to comment.