Skip to content

Instantly share code, notes, and snippets.

@davidbarral
Last active June 13, 2022 20:00
Show Gist options
  • Save davidbarral/0f035a9e1dfad8b496ba40edcf633d4c to your computer and use it in GitHub Desktop.
Save davidbarral/0f035a9e1dfad8b496ba40edcf633d4c to your computer and use it in GitHub Desktop.
DI Purist 3
const updateUserPreference = require("./use-cases/update-user-preference.js");
it("updates the user preference", () => {
const mockUpdate = jest.fn();
const mockRepo = { update: mockUpdate };
updateUserPreference({ key: "someKey", value: "someValue", { user: mockRepo });
expect(mockUpdate).toHaveBeenCalledWith(/* the updatedUser */);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment