import { Http } from "../../../commons/utils/http"; import { PageConfirmationEvent } from "./confirmation"; beforeEach(() => { const post = jest.fn(); post.mockClear(); (Http as any).post = post; }); test("creating order event with necessary parameters", async () => { const event = new PageConfirmationEvent("orderId").withProduct("product1", 99.99, 2).withProduct("product2", 59.99); await event.push(); expect(Http.post).toHaveBeenCalled(); expect(Http.post).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({ order: "orderId" })); });