|
6 | 6 | import { actionRepoSingleton, capitalizeFirstLetter, convertTemplatesToArray, getOrderInfo, getUpdatedPolicy } from "./helpers"; |
7 | 7 | import { Action, ISMTemplate, UIAction } from "../../../../models/interfaces"; |
8 | 8 | import { makeId } from "../../../utils/helpers"; |
9 | | -import { DEFAULT_POLICY } from "./constants"; |
| 9 | +import { DEFAULT_POLICY, DEFAULT_STOP_REPLICATION } from "./constants"; |
| 10 | +import { StopReplicationUIAction } from "../components/UIActions"; |
10 | 11 |
|
11 | 12 | test("converts all ism template formats into a list of ism templates", () => { |
12 | 13 | expect(convertTemplatesToArray(null)).toEqual([]); |
@@ -75,13 +76,22 @@ class DummyUIAction implements UIAction<DummyAction> { |
75 | 76 | } |
76 | 77 |
|
77 | 78 | test("action repository usage", () => { |
78 | | - expect(actionRepoSingleton.getAllActionTypes().length).toBe(15); |
79 | | - actionRepoSingleton.registerAction("dummy", DummyUIAction, DEFAULT_DUMMY); |
80 | 79 | expect(actionRepoSingleton.getAllActionTypes().length).toBe(16); |
| 80 | + actionRepoSingleton.registerAction("dummy", DummyUIAction, DEFAULT_DUMMY); |
| 81 | + expect(actionRepoSingleton.getAllActionTypes().length).toBe(17); |
81 | 82 | expect(actionRepoSingleton.getUIAction("dummy") instanceof DummyUIAction).toBe(true); |
82 | 83 | expect(actionRepoSingleton.getUIActionFromData(DEFAULT_DUMMY) instanceof DummyUIAction).toBe(true); |
83 | 84 | }); |
84 | 85 |
|
| 86 | +test("action repository supports stop replication action", () => { |
| 87 | + expect(actionRepoSingleton.getAllActionTypes()).toContain("stop_replication"); |
| 88 | + expect(actionRepoSingleton.getUIAction("stop_replication") instanceof StopReplicationUIAction).toBe(true); |
| 89 | + expect(actionRepoSingleton.getUIActionFromData(DEFAULT_STOP_REPLICATION) instanceof StopReplicationUIAction).toBe(true); |
| 90 | + expect(actionRepoSingleton.getUIActionFromData({ stop_replication: {} }).toAction()).toEqual({ |
| 91 | + stop_replication: {}, |
| 92 | + }); |
| 93 | +}); |
| 94 | + |
85 | 95 | test("changing the default state name correctly updates default_state", () => { |
86 | 96 | const policy = DEFAULT_POLICY; |
87 | 97 | const updatedState = { ...policy.states[0], name: "new_hot" }; |
|
0 commit comments