Last active
January 20, 2019 20:43
-
-
Save shlomokraus/a3a6d611c6c51f8687ee2bfd0aaab63d to your computer and use it in GitHub Desktop.
Demonstrate consuming Mockshot mocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MessageService } from "../src/MessageService"; | |
import { UserServiceMocks } from "../@mocks/mockshot-example/UserService"; | |
describe("MessageService", () => { | |
const getUserResult = UserServiceMocks.getUser("success"); | |
const userService = { | |
getUser: ()=>getUserResult | |
} | |
it("Should prepare message", async () => { | |
const messageService = new MessageService(userService); | |
const text = "This is message body"; | |
const message = await messageService.prepareMessage(text, "abc"); | |
expect(message.to).toEqual(getUserResult.email); | |
expect(message.title).toEqual(`Hello ${getUserResult.name}`); | |
expect(message.body).toEqual(text); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment