|
@@ -34,23 +34,33 @@ describe("GuessPane", () => {
|
|
|
|
|
|
it("resizes to medium on keydown Enter", () => {
|
|
it("resizes to medium on keydown Enter", () => {
|
|
const handle = shallow(<GuessPane />);
|
|
const handle = shallow(<GuessPane />);
|
|
- handle.find("div.resize--medium").first().simulate("keydown", { key: "Enter" });
|
|
|
|
|
|
+ handle
|
|
|
|
+ .find("div.resize--medium")
|
|
|
|
+ .first()
|
|
|
|
+ .simulate("keydown", { key: "Enter" });
|
|
expect(handle).toMatchSnapshot();
|
|
expect(handle).toMatchSnapshot();
|
|
});
|
|
});
|
|
|
|
|
|
it("submits", async () => {
|
|
it("submits", async () => {
|
|
- reverseGeocode.mockReturnValue("geocoded")
|
|
|
|
|
|
+ reverseGeocode.mockReturnValue("geocoded");
|
|
const handle = shallow(<GuessPane />);
|
|
const handle = shallow(<GuessPane />);
|
|
- handle.find("ClickMarkerMap").first().prop("onMarkerMoved")({ lat: "lat", lng: "lng" });
|
|
|
|
|
|
+ handle.find("ClickMarkerMap").first().prop("onMarkerMoved")({
|
|
|
|
+ lat: "lat",
|
|
|
|
+ lng: "lng",
|
|
|
|
+ });
|
|
// check submit enabled
|
|
// check submit enabled
|
|
expect(handle).toMatchSnapshot();
|
|
expect(handle).toMatchSnapshot();
|
|
await handle.find("button").first().prop("onClick")();
|
|
await handle.find("button").first().prop("onClick")();
|
|
- expect(reverseGeocode).toHaveBeenCalledWith(expect.objectContaining({ lat: "lat", lng: "lng" }));
|
|
|
|
- expect(dispatch.submitGuess).toHaveBeenCalledWith(expect.objectContaining({
|
|
|
|
- country: "geocoded",
|
|
|
|
- lat: "lat",
|
|
|
|
- lng: "lng",
|
|
|
|
- }));
|
|
|
|
|
|
+ expect(reverseGeocode).toHaveBeenCalledWith(
|
|
|
|
+ expect.objectContaining({ lat: "lat", lng: "lng" })
|
|
|
|
+ );
|
|
|
|
+ expect(dispatch.submitGuess).toHaveBeenCalledWith(
|
|
|
|
+ expect.objectContaining({
|
|
|
|
+ country: "geocoded",
|
|
|
|
+ lat: "lat",
|
|
|
|
+ lng: "lng",
|
|
|
|
+ })
|
|
|
|
+ );
|
|
// check submit disabled again
|
|
// check submit disabled again
|
|
expect(handle).toMatchSnapshot();
|
|
expect(handle).toMatchSnapshot();
|
|
});
|
|
});
|