Files
medusa-store/packages/medusa-react/test/hooks/admin/notifications/mutations.test.ts
2023-03-03 10:09:16 +01:00

33 lines
879 B
TypeScript

import { renderHook } from "@testing-library/react-hooks/dom"
import { fixtures } from "../../../../mocks/data"
import { useAdminResendNotification } from "../../../../src/"
import { createWrapper } from "../../../utils"
describe("useAdminResendNotification hook", () => {
test("resends a notification", async () => {
const notif = {
to: "me@me.me",
}
const { result, waitFor } = renderHook(
() => useAdminResendNotification("test-notification"),
{
wrapper: createWrapper(),
}
)
result.current.mutate(notif)
await waitFor(() => result.current.isSuccess)
expect(result.current.data.response.status).toEqual(200)
expect(result.current.data.notification).toEqual(
expect.objectContaining({
...fixtures.get("notification"),
...notif,
id: "test-notification",
})
)
})
})