more realistic pathnames in tests
parent
33c48c5851
commit
9b2df063c1
|
@ -1,7 +1,7 @@
|
|||
jest.mock("../../../history", () => ({
|
||||
history: {
|
||||
getCurrentLocation: () => {
|
||||
return { pathname: "//////add" };
|
||||
return { pathname: "/app/designer/plants/crop_search/aplant/add" };
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
|
|
@ -3,9 +3,15 @@ jest.mock("../../../history", () => ({
|
|||
history: {
|
||||
push: mockHistory,
|
||||
getCurrentLocation: jest.fn()
|
||||
.mockImplementationOnce(() => { return { pathname: "//app/plants" } })
|
||||
.mockImplementationOnce(() => { return { pathname: "//app/plants/1/edit" } })
|
||||
.mockImplementationOnce(() => { return { pathname: "//app/plants/1" } })
|
||||
.mockImplementationOnce(() => {
|
||||
return { pathname: "/app/designer/plants" }
|
||||
})
|
||||
.mockImplementationOnce(() => {
|
||||
return { pathname: "/app/designer/plants/1/edit" }
|
||||
})
|
||||
.mockImplementationOnce(() => {
|
||||
return { pathname: "/app/designer/plants/1" }
|
||||
})
|
||||
}
|
||||
}));
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ describe("<AddPlant />", () => {
|
|||
}]
|
||||
};
|
||||
Object.defineProperty(location, "pathname", {
|
||||
value: "//app/plants/crop_search/mint/add"
|
||||
value: "/app/designer/plants/crop_search/mint/add"
|
||||
});
|
||||
const wrapper = mount(<AddPlant {...props} />);
|
||||
expect(wrapper.text()).toContain("Mint");
|
||||
|
|
|
@ -27,7 +27,7 @@ import { shallow } from "enzyme";
|
|||
describe("<CropInfo />", () => {
|
||||
it("renders", () => {
|
||||
Object.defineProperty(location, "pathname", {
|
||||
value: "//app/plants/crop_search/mint"
|
||||
value: "/app/designer/plants/crop_search/mint"
|
||||
});
|
||||
const wrapper = shallow(
|
||||
<CropInfo
|
||||
|
|
|
@ -11,7 +11,7 @@ describe("<SelectPlants />", () => {
|
|||
beforeEach(function () {
|
||||
jest.clearAllMocks();
|
||||
Object.defineProperty(location, "pathname", {
|
||||
value: "//app/plants/select"
|
||||
value: "/app/designer/plants/select"
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue