// import { Http } from "../../commons/utils/http"; // import { EventType } from "../core/event"; // import { VTEXRunner } from "./vtex-runner"; // const vtexRunner = new VTEXRunner(); // beforeEach(() => { // const post = jest.fn().mockReturnValue({ status: 204 }); // post.mockClear(); // (Http as any).post = post; // }); // test("send api click event", async () => { // const clickData = Buffer.from( // JSON.stringify({ // uniqueId: "emailmkt", // product: "1", // }), // ).toString("base64"); // window.history.pushState({}, "", `/?baa=${clickData}`); // await vtexRunner.start(); // expect(Http.post).toHaveBeenCalledTimes(2); // expect(Http.post).toHaveBeenNthCalledWith( // 1, // expect.any(String), // expect.objectContaining({ type: EventType.SessionPing }), // ); // expect(Http.post).toHaveBeenNthCalledWith( // 2, // expect.any(String), // expect.objectContaining({ // type: EventType.ApiClick, // uniqueId: "emailmkt", // product: "1", // }), // ); // }); // test("send mail click event", async () => { // const clickData = Buffer.from( // JSON.stringify({ // id: "123456", // product: "1", // attempt: "1", // }), // ).toString("base64"); // window.history.pushState({}, "", `/?bma=${clickData}`); // await vtexRunner.start(); // expect(Http.post).toHaveBeenCalledTimes(2); // expect(Http.post).toHaveBeenNthCalledWith( // 1, // expect.any(String), // expect.objectContaining({ type: EventType.SessionPing }), // ); // expect(Http.post).toHaveBeenNthCalledWith( // 2, // expect.any(String), // expect.objectContaining({ // type: EventType.MailClick, // id: "123456", // product: "1", // attempt: "1", // }), // ); // });