Skip to content

Commit 3d085b4

Browse files
committed
chore: update storybook tests
1 parent c4a9c58 commit 3d085b4

5 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/features/carts/presentation/AddToCartButton/AddToCartButton.stories.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import {
66
waitForElementToBeRemoved,
77
expect,
88
} from "storybook/test";
9-
import { withRouter } from "storybook-addon-remix-react-router";
9+
import {
10+
withRouter,
11+
reactRouterParameters,
12+
} from "storybook-addon-remix-react-router";
1013

1114
import { getAddToCartHandler } from "@/test-lib/handlers/getAddToCartHandler";
1215
import { sleep } from "@/test-lib/storybook/sleep";
@@ -33,6 +36,9 @@ const meta = {
3336
msw: {
3437
handlers: [getAddToCartHandler()],
3538
},
39+
reactRouter: reactRouterParameters({
40+
routing: { path: "/products" },
41+
}),
3642
},
3743
} satisfies Meta<typeof AddToCartButton>;
3844

src/features/carts/presentation/CheckoutButton/CheckoutButton.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export const Purchasing: Story = {
2727
await userEvent.click(screen.getByRole("button", { name: /Checkout/ }));
2828

2929
await expect(
30-
screen.getByRole("button", { name: "Purchase" })
30+
screen.getByRole("button", { name: "Complete Order" })
3131
).toBeInTheDocument();
3232
});
3333

src/features/carts/presentation/CheckoutForm.stories.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const Purchasing: Story = {
2525
await step("Enter credentials", async () => {
2626
await userEvent.type(screen.getByLabelText(/Full Name/), "John Doe");
2727
await userEvent.type(
28-
screen.getByLabelText(/Your address/),
28+
screen.getByLabelText(/Address/),
2929
"NYC Groove Street"
3030
);
3131
await userEvent.selectOptions(
@@ -42,7 +42,9 @@ export const Purchasing: Story = {
4242
await step("Submit form", async () => {
4343
await sleep(500);
4444

45-
await userEvent.click(screen.getByRole("button", { name: "Purchase" }));
45+
await userEvent.click(
46+
screen.getByRole("button", { name: "Complete Order" })
47+
);
4648
});
4749

4850
await expect(

src/features/carts/presentation/ClearCartButton/ClearCartButton.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ export const ClearingCart: Story = {
3535
await step("Confirm clearing the cart", async () => {
3636
await sleep(500);
3737

38-
await userEvent.click(screen.getByRole("button", { name: /Confirm/ }));
38+
await userEvent.click(
39+
screen.getByRole("button", { name: /Yes, clear cart/ })
40+
);
3941
});
4042

4143
await expect(

src/features/carts/presentation/ClearCartButton/ConfirmClearCartDialog.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ import { useRef } from "react";
1616
import { useClearCart } from "@/features/carts/infrastructure/useClearCart";
1717
import { useConfirmClearCartDialogStore } from "@/features/carts/presentation/ClearCartButton/useConfirmClearCartDialogStore";
1818
import { useTranslations } from "@/lib/i18n/useTransations";
19-
import { useSecondaryTextColor } from "@/lib/theme/useSecondaryTextColor";
2019

2120
import { useClearCartNotifications } from "./useClearCartNotifications";
2221

2322
const ConfirmClearCartDialog = () => {
2423
const cancelRef = useRef<HTMLButtonElement>(null);
25-
const secondaryColor = useSecondaryTextColor();
2624
const [clear, isLoading] = useClearCart();
2725
const t = useTranslations("features.carts.clear-cart.dialog");
2826

@@ -48,9 +46,6 @@ const ConfirmClearCartDialog = () => {
4846
<AlertDialogBody>
4947
<VStack align="stretch">
5048
<Text>{t("message")}</Text>
51-
<Text fontSize="sm" color={secondaryColor}>
52-
{t("message")}
53-
</Text>
5449
</VStack>
5550
</AlertDialogBody>
5651

0 commit comments

Comments
 (0)