mapStateToProps tests.
parent
0c687233c7
commit
ad5b8cca37
|
@ -6,12 +6,14 @@ jest.mock("../../../history", () => ({
|
|||
|
||||
import * as React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { RawAddPlant as AddPlant, AddPlantProps } from "../add_plant";
|
||||
import { RawAddPlant as AddPlant, AddPlantProps, mapStateToProps } from "../add_plant";
|
||||
import { history } from "../../../history";
|
||||
import {
|
||||
fakeCropLiveSearchResult
|
||||
} from "../../../__test_support__/fake_crop_search_result";
|
||||
import { svgToUrl } from "../../../open_farm/icons";
|
||||
import { fakeState } from "../../../__test_support__/fake_state";
|
||||
import { CropLiveSearchResult } from "../../interfaces";
|
||||
|
||||
describe("<AddPlant />", () => {
|
||||
const fakeProps = (): AddPlantProps => {
|
||||
|
@ -43,3 +45,26 @@ describe("<AddPlant />", () => {
|
|||
"/app/designer/plants/crop_search/mint");
|
||||
});
|
||||
});
|
||||
|
||||
describe("mapStateToProps", () => {
|
||||
it("maps state to props", () => {
|
||||
const state = fakeState();
|
||||
const crop: CropLiveSearchResult = {
|
||||
crop: {
|
||||
name: "fake",
|
||||
slug: "fake",
|
||||
binomial_name: "fake",
|
||||
common_names: ["fake"],
|
||||
description: "",
|
||||
sun_requirements: "",
|
||||
sowing_method: "",
|
||||
processing_pictures: 0
|
||||
},
|
||||
image: "X"
|
||||
};
|
||||
state.resources.consumers.farm_designer.cropSearchResults = [crop];
|
||||
const results = mapStateToProps(state);
|
||||
expect(results.cropSearchResults).toEqual([crop]);
|
||||
expect(results.xy_swap).toEqual(false);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -90,7 +90,7 @@ export class PlantGrid extends React.Component<PlantGridProps, PlantGridState> {
|
|||
|
||||
render() {
|
||||
return <div>
|
||||
<hr style={{ borderTop: "1.5px solid rgba(255, 255, 255 ,0.7);" }} />
|
||||
<hr style={{ borderTop: "1.5px solid rgba(255, 255, 255 ,0.7)" }} />
|
||||
<h3>
|
||||
{t("Grid and Row Planting")}
|
||||
</h3>
|
||||
|
|
Loading…
Reference in New Issue