1 import {getTestBed, TestBed} from '@angular/core/testing';
2 import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
3 import {NgRedux} from "@angular-redux/store";
4 import {DragAndDropService} from "./dragAndDrop.service";
5 import {AppState} from "../../../../shared/store/reducers";
7 class MockAppStore<T> {
15 "FLAG_1911_INSTANTIATION_ORDER_IN_ASYNC_ALACARTE" : true
20 "serviceInstanceId": {
51 describe('Drag and drop service', () => {
53 let service: DragAndDropService;
54 let httpMock: HttpTestingController;
55 let store: NgRedux<AppState>;
57 beforeAll(done => (async () => {
58 TestBed.configureTestingModule({
59 imports: [HttpClientTestingModule],
62 {provide: NgRedux, useClass: MockAppStore}]
64 await TestBed.compileComponents();
66 injector = getTestBed();
67 service = injector.get(DragAndDropService);
68 httpMock = injector.get(HttpTestingController);
69 store = injector.get(NgRedux);
70 })().then(done).catch(done.fail));
73 test('drag should move element position', () => {
75 "modelCustomizationId": "91415b44-753d-494c-926a-456a9172bbb9",
76 "modelId": "d6557200-ecf2-4641-8094-5393ae3aae60",
77 "modelUniqueId": "91415b44-753d-494c-926a-456a9172bbb9",
83 "modelName": "VF_vGeraldine 0",
85 "isEcompGeneratedNaming": true,
86 "networkStoreKey": "VF_vGeraldine 0:0001",
87 "vnfStoreKey": "VF_vGeraldine 0:0001",
89 "menuActions": {"edit": {}, "showAuditInfo": {}, "duplicate": {}, "remove": {}, "delete": {}, "undoDelete": {}},
91 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
92 "key": "Orch Status:",
93 "testId": "orchStatus"
95 "trackById": "di9khuolht",
99 "modelCustomizationId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
100 "modelId": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
101 "modelUniqueId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
102 "missingData": false,
106 "modelName": "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0",
108 "isEcompGeneratedNaming": true,
110 "dynamicModelName": "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0bykqx",
112 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
114 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
115 "key": "Orch Status:",
116 "testId": "orchStatus"
118 "trackById": "5pfyfah820h",
123 "modelCustomizationId": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
124 "modelId": "41708296-e443-4c71-953f-d9a010f059e1",
125 "modelUniqueId": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
126 "missingData": false,
129 "name": "VNFModule3",
130 "modelName": "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2",
132 "isEcompGeneratedNaming": true,
134 "dynamicModelName": "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2fjrrc",
136 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
138 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
139 "key": "Orch Status:",
140 "testId": "orchStatus"
142 "trackById": "i3dllio31bb",
147 "modelCustomizationId": "55b1be94-671a-403e-a26c-667e9c47d091",
148 "modelId": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
149 "modelUniqueId": "55b1be94-671a-403e-a26c-667e9c47d091",
150 "missingData": false,
154 "modelName": "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1",
156 "isEcompGeneratedNaming": true,
158 "dynamicModelName": "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1djjni",
160 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
162 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
163 "key": "Orch Status:",
164 "testId": "orchStatus"
166 "trackById": "w7bvw1nh47s",
173 "modelCustomizationId": "91415b44-753d-494c-926a-456a9172bbb9",
174 "modelId": "d6557200-ecf2-4641-8094-5393ae3aae60",
175 "modelUniqueId": "91415b44-753d-494c-926a-456a9172bbb9",
176 "missingData": false,
181 "modelName": "VF_vGeraldine 0",
183 "isEcompGeneratedNaming": true,
184 "networkStoreKey": "VF_vGeraldine 0",
185 "vnfStoreKey": "VF_vGeraldine 0",
187 "menuActions": {"edit": {}, "showAuditInfo": {}, "duplicate": {}, "remove": {}, "delete": {}, "undoDelete": {}},
189 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
190 "key": "Orch Status:",
191 "testId": "orchStatus"
193 "trackById": "fjczf1urdqo",
214 jest.spyOn(service, 'array_move');
216 service.drag(store, "serviceInstanceId", nodes, {from, to});
219 expect(service.array_move).toHaveBeenCalled();