blob: fd5fe0e65cc9140907917fbb0cb1f29b0e0855e4 [file] [log] [blame]
Yoav Schneiderman51d97842020-01-01 10:23:16 +02001import {getTestBed, TestBed} from "@angular/core/testing";
2import {IframeService} from "./iframe.service";
3import {DialogService} from "ng2-bootstrap-modal";
4
5export class DialogServiceMock extends DialogService {
6 removeDialog: (that) => ({})
7}
8
9describe('Iframe service', () => {
10 let injector;
11 let service: IframeService;
12 beforeAll(done => (async () => {
13 TestBed.configureTestingModule({
14 providers : [
15 IframeService
16 ]
17 });
18 await TestBed.compileComponents();
19
20 injector = getTestBed();
21 service = injector.get(IframeService);
22
23 })().then(done).catch(done.fail));
24
25
26 test('service should be defined', ()=>{
27 expect(service).toBeDefined();
28 });
29
30 test('closeIframe: should call removeClassCloseModal', ()=>{
31 const dialogService = new DialogServiceMock(null, null, null, null);
32 spyOn(service, 'removeClassCloseModal');
33 spyOn(dialogService, 'removeDialog');
34 service.closeIframe(dialogService, {})
35
36 expect(service.removeClassCloseModal).toBeCalledWith('content');
37 expect(dialogService.removeDialog).toBeCalledWith({});
38 });
39
40});