1 import {TestBed, getTestBed} from '@angular/core/testing';
3 HttpClientTestingModule,
5 } from '@angular/common/http/testing';
6 import {NgRedux} from "@angular-redux/store";
7 import {DragAndDropService} from "./dragAndDrop.service";
8 import {AppState} from "../../../../shared/store/reducers";
10 class MockAppStore<T> {
18 "DRAG_AND_DROP_OPERATION" : true
23 "serviceInstanceId": {
54 describe('Drag and drop service', () => {
56 let service: DragAndDropService;
57 let httpMock: HttpTestingController;
58 let store: NgRedux<AppState>;
60 beforeAll(done => (async () => {
61 TestBed.configureTestingModule({
62 imports: [HttpClientTestingModule],
65 {provide: NgRedux, useClass: MockAppStore}]
67 await TestBed.compileComponents();
69 injector = getTestBed();
70 service = injector.get(DragAndDropService);
71 httpMock = injector.get(HttpTestingController);
72 store = injector.get(NgRedux);
73 })().then(done).catch(done.fail));
76 test('drag should move element position', () => {
78 "modelCustomizationId": "91415b44-753d-494c-926a-456a9172bbb9",
79 "modelId": "d6557200-ecf2-4641-8094-5393ae3aae60",
80 "modelUniqueId": "91415b44-753d-494c-926a-456a9172bbb9",
86 "modelName": "VF_vMee 0",
88 "isEcompGeneratedNaming": true,
89 "networkStoreKey": "VF_vMee 0:0001",
90 "vnfStoreKey": "VF_vMee 0:0001",
92 "menuActions": {"edit": {}, "showAuditInfo": {}, "duplicate": {}, "remove": {}, "delete": {}, "undoDelete": {}},
94 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
95 "key": "Orch Status:",
96 "testId": "orchStatus"
98 "trackById": "di9khuolht",
102 "modelCustomizationId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
103 "modelId": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
104 "modelUniqueId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
105 "missingData": false,
109 "modelName": "vf_vmee0..VfVmee..base_vmme..module-0",
111 "isEcompGeneratedNaming": true,
113 "dynamicModelName": "vf_vmee0..VfVmee..base_vmme..module-0bykqx",
115 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
117 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
118 "key": "Orch Status:",
119 "testId": "orchStatus"
121 "trackById": "5pfyfah820h",
126 "modelCustomizationId": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
127 "modelId": "41708296-e443-4c71-953f-d9a010f059e1",
128 "modelUniqueId": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
129 "missingData": false,
132 "name": "VNFModule3",
133 "modelName": "vf_vmee0..VfVmee..vmme_gpb..module-2",
135 "isEcompGeneratedNaming": true,
137 "dynamicModelName": "vf_vmee0..VfVmee..vmme_gpb..module-2fjrrc",
139 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
141 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
142 "key": "Orch Status:",
143 "testId": "orchStatus"
145 "trackById": "i3dllio31bb",
150 "modelCustomizationId": "55b1be94-671a-403e-a26c-667e9c47d091",
151 "modelId": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
152 "modelUniqueId": "55b1be94-671a-403e-a26c-667e9c47d091",
153 "missingData": false,
157 "modelName": "vf_vmee0..VfVmee..vmme_vlc..module-1",
159 "isEcompGeneratedNaming": true,
161 "dynamicModelName": "vf_vmee0..VfVmee..vmme_vlc..module-1djjni",
163 "menuActions": {"edit": {}, "showAuditInfo": {}, "remove": {}, "delete": {}, "undoDelete": {}},
165 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
166 "key": "Orch Status:",
167 "testId": "orchStatus"
169 "trackById": "w7bvw1nh47s",
176 "modelCustomizationId": "91415b44-753d-494c-926a-456a9172bbb9",
177 "modelId": "d6557200-ecf2-4641-8094-5393ae3aae60",
178 "modelUniqueId": "91415b44-753d-494c-926a-456a9172bbb9",
179 "missingData": false,
184 "modelName": "VF_vMee 0",
186 "isEcompGeneratedNaming": true,
187 "networkStoreKey": "VF_vMee 0",
188 "vnfStoreKey": "VF_vMee 0",
190 "menuActions": {"edit": {}, "showAuditInfo": {}, "duplicate": {}, "remove": {}, "delete": {}, "undoDelete": {}},
192 "statusProperties": [{"key": "Prov Status:", "testId": "provStatus"}, {
193 "key": "Orch Status:",
194 "testId": "orchStatus"
196 "trackById": "fjczf1urdqo",
217 jest.spyOn(service, 'array_move');
219 service.drag(store, "serviceInstanceId", nodes, {from, to});
222 expect(service.array_move).toHaveBeenCalled();