2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
39 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
41 import { NewNotificationModalComponent } from './new-notification-modal.component';
42 import { FormsModule } from '@angular/forms';
43 import { HttpClientTestingModule } from '@angular/common/http/testing';
44 import { NgMaterialModule } from 'src/app/ng-material-module';
45 import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
46 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
47 import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
48 import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
49 import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
51 describe('NewNotificationModalComponent', () => {
52 let component: NewNotificationModalComponent;
53 let component1: NewNotificationModalComponent;
54 let fixture: ComponentFixture<NewNotificationModalComponent>;
55 let fixture1: ComponentFixture<NewNotificationModalComponent>;
56 const selectedNotification ={"msgSource":"TestSource","priority":1,"startTime":"10/11/2020","endTime":"10/11/2021"}
58 beforeEach(async(() => {
59 TestBed.configureTestingModule({
60 declarations: [ NewNotificationModalComponent ,InformationModalComponent,ConfirmationModalComponent],
61 imports:[FormsModule,HttpClientTestingModule,NgMaterialModule,BrowserAnimationsModule,NgbModule.forRoot()],
62 providers:[NgbActiveModal]
63 }).overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent,ConfirmationModalComponent] } })
68 fixture = TestBed.createComponent(NewNotificationModalComponent);
69 component = fixture.componentInstance;
70 fixture.detectChanges();
73 fixture1 = TestBed.createComponent(NewNotificationModalComponent);
74 component1 = fixture1.componentInstance;
75 component1.selectedNotification = selectedNotification;
76 fixture1.detectChanges();
81 it('should create', () => {
82 expect(component).toBeTruthy();
85 it('addUserNotification should return stubbed value', () => {
86 spyOn(component1, 'addUserNotification').and.callThrough();
87 component1.addUserNotification();
88 expect(component1.addUserNotification).toHaveBeenCalledWith();
91 it('settingTreeParam should return stubbed value', () => {
92 spyOn(component1, 'settingTreeParam').and.callThrough();
93 component1.settingTreeParam();
94 expect(component1.settingTreeParam).toHaveBeenCalledWith();
97 it('checkTreeSelect should return stubbed value', () => {
98 spyOn(component1, 'checkTreeSelect').and.callThrough();
99 component1.checkTreeSelect();
100 expect(component1.checkTreeSelect).toHaveBeenCalledWith();
103 it('openConfirmationModal should return stubbed value', () => {
104 spyOn(component1, 'openConfirmationModal').and.callThrough();
105 component1.openConfirmationModal('Title','Message');
106 expect(component1.openConfirmationModal).toHaveBeenCalledWith('Title','Message');
109 it('openInformationModal should return stubbed value', () => {
110 spyOn(component1, 'openInformationModal').and.callThrough();
111 component1.openInformationModal('Title','Message');
112 expect(component1.openInformationModal).toHaveBeenCalledWith('Title','Message');