Skip to content

Commit

Permalink
Test the plan detail with TEST_NUTRITIONAL_PLAN_1
Browse files Browse the repository at this point in the history
That one has more diary entries, so the different charts and tables will be
rendered as well
  • Loading branch information
rolandgeider committed Jul 30, 2023
1 parent 2db8e9b commit 67b2e5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/components/Nutrition/components/PlanDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
import { PlanDetail } from "components/Nutrition/components/PlanDetail";
import { useFetchNutritionalPlanQuery } from "components/Nutrition/queries";
import { MemoryRouter, Route, Routes } from "react-router";
import { TEST_NUTRITIONAL_PLAN_2 } from "tests/nutritionTestdata";
import { TEST_NUTRITIONAL_PLAN_1 } from "tests/nutritionTestdata";

jest.mock("components/Nutrition/queries");
jest.useFakeTimers();
Expand All @@ -12,12 +12,12 @@ const { ResizeObserver } = window;
const queryClient = new QueryClient();

describe("Test the PlanDetail component", () => {

beforeEach(() => {
// @ts-ignore
useFetchNutritionalPlanQuery.mockImplementation(() => ({
isSuccess: true,
data: TEST_NUTRITIONAL_PLAN_2
data: TEST_NUTRITIONAL_PLAN_1
}));

// @ts-ignore
Expand Down Expand Up @@ -52,8 +52,8 @@ describe("Test the PlanDetail component", () => {

// Assert
expect(useFetchNutritionalPlanQuery).toHaveBeenCalled();
expect(screen.getByText('Bulking till we puke')).toBeInTheDocument();
expect(screen.getByText('Cake time')).toBeInTheDocument();
expect(screen.getByText('Time to visit McDonalds')).toBeInTheDocument();
expect(screen.getByText('Second breakfast')).toBeInTheDocument();
expect(screen.getByText('evening snack')).toBeInTheDocument();
expect(screen.getByText('breakfast')).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion src/tests/nutritionTestdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const TEST_MEAL_ITEM_1 = new MealItem(
TEST_INGREDIENT_1
);
export const TEST_MEAL_ITEM_2 = new MealItem(
42,
43,
102,
null,
220,
Expand Down

0 comments on commit 67b2e5d

Please sign in to comment.