/
sequences_test.tsx
53 lines (49 loc) · 1.56 KB
/
sequences_test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
jest.mock("react-redux", () => ({
connect: jest.fn()
}));
import * as React from "react";
import { Sequences } from "../sequences";
import { shallow } from "enzyme";
import { Props } from "../interfaces";
import {
FAKE_RESOURCES, buildResourceIndex
} from "../../__test_support__/resource_index_builder";
import { fakeSequence } from "../../__test_support__/fake_state/resources";
import { ToolTips } from "../../constants";
import {
fakeHardwareFlags
} from "../../__test_support__/sequence_hardware_settings";
describe("<Sequences/>", () => {
function fakeProps(): Props {
return {
dispatch: jest.fn(),
sequence: fakeSequence(),
sequences: [],
resources: buildResourceIndex(FAKE_RESOURCES).index,
syncStatus: "synced",
hardwareFlags: fakeHardwareFlags(),
farmwareInfo: {
farmwareNames: [],
firstPartyFarmwareNames: [],
showFirstPartyFarmware: false,
farmwareConfigs: {},
},
shouldDisplay: jest.fn(),
confirmStepDeletion: false,
menuOpen: false,
};
}
it("renders", () => {
const wrapper = shallow(<Sequences {...fakeProps()} />);
expect(wrapper.html()).toContain("Sequences");
expect(wrapper.html()).toContain("Sequence Editor");
expect(wrapper.html()).toContain(ToolTips.SEQUENCE_EDITOR);
expect(wrapper.html()).toContain("Commands");
});
it("step command cluster is hidden", () => {
const p = fakeProps();
p.sequence = undefined;
const wrapper = shallow(<Sequences {...p} />);
expect(wrapper.text()).not.toContain("Commands");
});
});