Skip to content

Commit b1f291b

Browse files
author
Shawn Toubeau
committed
fixes menu tests
1 parent 99eacf6 commit b1f291b

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/components/Menu/menu.spec.tsx

+12-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import { Provider } from "react-redux";
33
import configureStore from "redux-mock-store";
44
import { mount } from "../../setupTests";
5-
import Menu, { MenuProps } from ".";
5+
import Menu, { Props } from ".";
66
import { initialState } from "../../models/maze/initialState";
77
import { initialState as MenuInitialState } from "../../models/menu/initialState";
88
import {
@@ -17,10 +17,10 @@ const mockStore = configureStore();
1717
describe("<Menu />", () => {
1818
let wrapper: any;
1919

20-
const props: MenuProps = {
20+
const props: Props = {
2121
canMoveStart: false,
2222
canMoveEnd: false,
23-
selectedAlgo: undefined,
23+
selectedAlgo: "A*",
2424
algorithms: [
2525
{ value: "A*", text: "A*" },
2626
{ value: "Djikstras", text: "Djikstras" },
@@ -36,15 +36,14 @@ describe("<Menu />", () => {
3636
onClear: jest.fn(),
3737
toggleMoveStart: jest.fn(),
3838
toggleMoveEnd: jest.fn(),
39-
saveMaze: jest.fn(),
4039
loadMaze: jest.fn(),
4140
handleDropdownSpeed: jest.fn(),
4241
randomizeWalls: jest.fn(),
4342
playSpeeds: MenuInitialState.playSpeeds,
4443
startTime: undefined,
4544
endTime: undefined,
4645
currentSpeed: 1,
47-
updateGridSize: jest.fn(),
46+
handleChangeGridSize: jest.fn(),
4847
};
4948

5049
it("defines the component", () => {
@@ -60,9 +59,9 @@ describe("<Menu />", () => {
6059
it("Menu renders with icons", () => {
6160
expect(wrapper.find(SemanticMenu)).toBeDefined();
6261
expect(wrapper.find(SemanticMenu.Item)).toBeDefined();
63-
expect(wrapper.find(SemanticMenu.Item)).toHaveLength(5);
62+
expect(wrapper.find(SemanticMenu.Item)).toHaveLength(4);
6463
expect(wrapper.find(SemanticIcon)).toBeDefined();
65-
expect(wrapper.find(SemanticIcon)).toHaveLength(12);
64+
expect(wrapper.find(SemanticIcon)).toHaveLength(13);
6665
});
6766

6867
it("Dropdown renders", () => {
@@ -71,7 +70,7 @@ describe("<Menu />", () => {
7170

7271
it("Buttons render", () => {
7372
expect(wrapper.find(SemanticButton)).toBeDefined();
74-
expect(wrapper.find(SemanticButton)).toHaveLength(10);
73+
expect(wrapper.find(SemanticButton)).toHaveLength(11);
7574
});
7675

7776
it("Play button calls action", () => {
@@ -97,22 +96,22 @@ describe("<Menu />", () => {
9796
});
9897

9998
it("Move Start Point button calls action", () => {
100-
wrapper.find(SemanticButton).at(3).simulate("click");
99+
wrapper.find(SemanticButton).at(8).simulate("click");
101100
expect(props.toggleMoveStart).toHaveBeenCalled();
102101
});
103102

104103
it("Move End Point button calls action", () => {
105-
wrapper.find(SemanticButton).at(4).simulate("click");
104+
wrapper.find(SemanticButton).at(9).simulate("click");
106105
expect(props.toggleMoveEnd).toHaveBeenCalled();
107106
});
108107

109-
it("Clear button calls action", () => {
110-
wrapper.find(SemanticButton).at(5).simulate("click");
108+
it("Randomize walls button calls action", () => {
109+
wrapper.find(SemanticButton).at(2).simulate("click");
111110
expect(props.randomizeWalls).toHaveBeenCalled();
112111
});
113112

114113
it("Clear button calls action", () => {
115-
wrapper.find(SemanticButton).at(6).simulate("click");
114+
wrapper.find(SemanticButton).at(3).simulate("click");
116115
expect(props.onClear).toHaveBeenCalled();
117116
});
118117

0 commit comments

Comments
 (0)