24 lines
1021 B
TypeScript
24 lines
1021 B
TypeScript
|
import { renderWithProviders } from "@/lib/rendering";
|
||
|
import { ProductEditor } from "@/components/ProductEditor";
|
||
|
import {products as fixtures} from "../../__fixtures__/initialProducts";
|
||
|
import React from "react";
|
||
|
import { useAppSelector } from "@/app/store";
|
||
|
import { selectProducts } from "@/features/product/productSlice";
|
||
|
import { screen } from "@testing-library/react-native";
|
||
|
|
||
|
describe("ProductEditor", () => {
|
||
|
it("renders correctly", async () => {
|
||
|
const {store} = renderWithProviders(<ProductEditor />, {
|
||
|
products: fixtures,
|
||
|
});
|
||
|
|
||
|
const products = store.getState();
|
||
|
|
||
|
// Check if the product names are rendered
|
||
|
expect(screen.getByText(products[0].attributes.name as string)).toBeTruthy();
|
||
|
expect(screen.getByText(products[1].attributes.name as string)).toBeTruthy();
|
||
|
expect(screen.getByText(products[2].attributes.name as string)).toBeTruthy();
|
||
|
expect(screen.getByText(products[3].attributes.name as string)).toBeTruthy();
|
||
|
});
|
||
|
});
|