summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
diff options
context:
space:
mode:
authorYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-22 11:07:00 +0200
committerYoav Schneiderman <yoav.schneiderman@intl.att.com>2020-01-27 17:36:26 +0200
commit3f216a5ba38d70c193256f05c634093da9599984 (patch)
tree29bb202d705bf1426d3cda3c4ac98c59b84fb0d7 /vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
parent212806afa99581acd7618add8be958d945690867 (diff)
When feature toggle is active then SDNC preload files is enable.
Issue-ID: VID-752 Change-Id: I96ef914bfe37d82da20085227b930523fcdba8fc Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts')
-rw-r--r--vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts56
1 files changed, 56 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
new file mode 100644
index 000000000..ffaccb198
--- /dev/null
+++ b/vid-webpack-master/src/app/shared/components/messageModal/message-modal.service.spec.ts
@@ -0,0 +1,56 @@
+import {MessageModal} from "./message-modal.service";
+import {getTestBed, TestBed} from "@angular/core/testing";
+import {SdcUiCommon} from "onap-ui-angular";
+import each from "jest-each";
+import {MessageBoxService} from "../messageBox/messageBox.service";
+import {MessageModalModel} from "./message-modal.model";
+import {MessageBoxData} from "../messageBox/messageBox.data";
+
+
+describe('Message Modal Service', () => {
+ let injector;
+ let service: MessageModal;
+
+ beforeAll(done => (async () => {
+ TestBed.configureTestingModule({
+ imports: [],
+ providers: [MessageModal]
+ });
+ await TestBed.compileComponents();
+
+ injector = getTestBed();
+ service = injector.get(MessageModal);
+ })().then(done).catch(done.fail));
+
+
+ each([
+ ["error", SdcUiCommon.ModalType.error],
+ ["info", SdcUiCommon.ModalType.info],
+ ["success", SdcUiCommon.ModalType.success]
+ ]).test('getModalType with type %s should return %s', (inputMessageType, expectedResult) => {
+
+ let message = {
+ type: inputMessageType
+ };
+
+ const type = MessageModal.getModalType(<any>message)
+ expect(type).toEqual(expectedResult);
+ });
+
+ test('showMessageModal should call open modal with all data' , async (done)=>{
+ spyOn(MessageBoxService.openModal, 'next');
+ let message : MessageModalModel = new MessageModalModel('title', 'text', "success", []);
+
+ MessageModal.showMessageModal(message);
+ setTimeout(()=>{
+ const messageBoxData = new MessageBoxData( message.title,
+ message.text,
+ SdcUiCommon.ModalType.success,
+ SdcUiCommon.ModalSize.medium,
+ message.buttons)
+ expect(MessageBoxService.openModal.next).toHaveBeenCalledWith(messageBoxData);
+ done();
+ }, 500)
+ });
+
+});