Skip to content

Commit

Permalink
fix more lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardcho1231 committed Mar 27, 2024
1 parent dcddb97 commit 024dac9
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions blocks/subscriptions-block/features/checkout/default.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";

import { render, screen, act } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import "@testing-library/jest-dom";

import { useIdentity, usePhrases } from "@wpmedia/arc-themes-components";
Expand Down Expand Up @@ -40,16 +40,14 @@ describe("Checkout Feature", () => {
Sales: {},
});

await act(async () => {
render(
<Checkout
customFields={{
offerURL: "/offer-url/"
}}
/>,
);
});
expect(screen.getByText("Billing Address Placeholder")).not.toBeNull();
render(
<Checkout
customFields={{
offerURL: "/offer-url/"
}}
/>,
);
expect(await screen.findByText("Billing Address Placeholder")).not.toBeNull();
});
it("redirects user to login url when user is not logged in", async () => {
useIdentity.mockImplementation(() => ({
Expand All @@ -73,16 +71,15 @@ describe("Checkout Feature", () => {
Sales: {},
});

await act(async () => {
render(
<Checkout
customFields={{
loginURL: "/login-url/",
}}
/>,
);
});
expect(screen.getByText("Account Placeholder")).not.toBeNull();
expect(window.location.href).toBe("/login-url/?redirect=checkoutURL");
render(
<Checkout
customFields={{
loginURL: "/login-url/",
}}
/>,
);

expect(await screen.findByText("Account Placeholder")).not.toBeNull();
await waitFor(() => expect(window.location.href).toBe("/login-url/?redirect=checkoutURL"));
});
});

0 comments on commit 024dac9

Please sign in to comment.