Skip to content

Commit

Permalink
refine naming of test mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Oct 22, 2024
1 parent 920ad9d commit a38c480
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export const props: PresentationalProps = {
latitude: 51.5230919,
};

export const previousSingleDataProps: PresentationalProps = {
export const previouslySubmittedSingleFeatureProps: PresentationalProps = {
...props,
previouslySubmittedData: previouslySubmittedSingleFeature,
};

export const previousDoubleDataProps: PresentationalProps = {
export const previouslySubmittedDoubleFeatureProps: PresentationalProps = {
...props,
previouslySubmittedData: previouslySubmittedDoubleFeature,
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import { it, vi } from "vitest";
import { Presentational as MapAndLabel } from "../Public";
import { point1, point2, point3 } from "./mocks/geojson";
import {
previousDoubleDataProps,
previousSingleDataProps,
previouslySubmittedDoubleFeatureProps,
previouslySubmittedSingleFeatureProps,
} from "./mocks/Trees";
import { addFeaturesToMap, addMultipleFeatures, clickContinue } from "./utils";
import { screen } from "@testing-library/react";
import { userDataSchema } from "@planx/components/AddressInput/model";
import { addMultipleFeatures, clickContinue } from "./utils";

beforeAll(() => {
if (!window.customElements.get("my-map")) {
Expand All @@ -30,7 +28,7 @@ beforeAll(() => {
describe("navigating back after adding single feature", () => {
it("shows previously submitted features", async () => {
const { getByTestId, queryByRole } = setup(
<MapAndLabel {...previousSingleDataProps} />,
<MapAndLabel {...previouslySubmittedSingleFeatureProps} />
);
const map = getByTestId("map-and-label-map");

Expand All @@ -56,7 +54,7 @@ describe("navigating back after adding single feature", () => {
describe("navigating back after adding two features", () => {
it("shows previously submitted features", async () => {
const { getByTestId, queryByRole } = setup(
<MapAndLabel {...previousDoubleDataProps} />,
<MapAndLabel {...previouslySubmittedDoubleFeatureProps} />
);
const map = getByTestId("map-and-label-map");

Expand All @@ -82,7 +80,10 @@ describe("navigating back after adding two features", () => {
it.only("should maintain labelling when removing a feature", async () => {
const handleSubmit = vi.fn();
const { getByRole, user } = setup(
<MapAndLabel {...previousDoubleDataProps} handleSubmit={handleSubmit} />,
<MapAndLabel
{...previouslySubmittedDoubleFeatureProps}
handleSubmit={handleSubmit}
/>
);

const firstTab = getByRole("tab", { name: /Tree 1/ });
Expand Down

0 comments on commit a38c480

Please sign in to comment.