Unit tests

This commit is contained in:
Matthew Ross 2018-04-11 17:21:27 -04:00
parent c8acf01ea2
commit 7132e26f8a
28 changed files with 445 additions and 378 deletions

20
package-lock.json generated
View File

@ -32,7 +32,7 @@
"requires": {
"ajv": "5.5.2",
"chokidar": "1.7.0",
"rxjs": "5.5.8",
"rxjs": "5.5.9",
"source-map": "0.5.7"
},
"dependencies": {
@ -57,7 +57,7 @@
"dev": true,
"requires": {
"@ngtools/json-schema": "1.2.0",
"rxjs": "5.5.8"
"rxjs": "5.5.9"
}
},
"@angular/animations": {
@ -117,7 +117,7 @@
"postcss-url": "7.3.2",
"raw-loader": "0.5.1",
"resolve": "1.5.0",
"rxjs": "5.5.8",
"rxjs": "5.5.9",
"sass-loader": "6.0.7",
"semver": "5.5.0",
"silent-error": "1.1.0",
@ -270,7 +270,7 @@
"integrity": "sha512-7aVP4994Hu8vRdTTohXkfGWEwLhrdNP3EZnWyBootm5zshWqlQojUGweZe5zwewsKcixeVOiy2YtW+aI4aGSLA==",
"dev": true,
"requires": {
"rxjs": "5.5.8",
"rxjs": "5.5.9",
"semver": "5.5.0",
"semver-intersect": "1.3.1"
}
@ -291,9 +291,9 @@
}
},
"@types/node": {
"version": "9.6.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.2.tgz",
"integrity": "sha512-UWkRY9X7RQHp5OhhRIIka58/gVVycL1zHZu0OTsT5LI86ABaMOSbUjAl+b0FeDhQcxclrkyft3kW5QWdMRs8wQ==",
"version": "9.6.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.4.tgz",
"integrity": "sha512-Awg4BcUYiZtNKoveGOu654JVPt11V/KIC77iBz8NweyoOAZpz5rUJfPDwwD+ajfTs2HndbTCEB8IuLfX9m/mmw==",
"dev": true
},
"@types/q": {
@ -9388,9 +9388,9 @@
}
},
"rxjs": {
"version": "5.5.8",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.8.tgz",
"integrity": "sha512-Bz7qou7VAIoGiglJZbzbXa4vpX5BmTTN2Dj/se6+SwADtw4SihqBIiEa7VmTXJ8pynvq0iFr5Gx9VLyye1rIxQ==",
"version": "5.5.9",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.9.tgz",
"integrity": "sha512-DHG9AHmCmgaFWgjBcXp6NxFDmh3MvIA62GqTWmLnTzr/3oZ6h5hLD8NA+9j+GF0jEwklNIpI4KuuyLG8UWMEvQ==",
"requires": {
"symbol-observable": "1.0.1"
}

View File

@ -52,7 +52,7 @@
"highlight.js": "^9.12.0",
"marked": "^0.3.19",
"ng2-dragula": "^1.5.0",
"rxjs": "^5.5.8",
"rxjs": "^5.5.9",
"scss-base": "^1.4.0",
"zone.js": "^0.8.26"
},
@ -62,7 +62,7 @@
"@angular/language-service": "^5.2.9",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~9.6.2",
"@types/node": "~9.6.4",
"bourbon": "5.0.0",
"bourbon-neat": "1.9.0",
"codelyzer": "^4.2.1",

View File

@ -80,7 +80,6 @@ export class UserSettingsService {
return this.http.post('api/users/' + this.activeUser.id, json)
.map((response: ApiResponse) => {
this.auth.updateUser(JSON.parse(response.data[1]));
console.log(response);
return response;
})

View File

@ -17,7 +17,7 @@ export class ContextMenu {
isOpen = false;
constructor(private el: ElementRef,
constructor(public el: ElementRef,
private menuService: ContextMenuService,
private sanitizer: DomSanitizer) {
menuService.registerMenu(this);

View File

@ -27,7 +27,7 @@ export class Modal implements OnInit {
isOpen = false;
animate = true;
constructor(private modalService: ModalService) {
constructor(public modalService: ModalService) {
}
ngOnInit() {

View File

@ -214,7 +214,7 @@ describe('BoardService', () => {
} else {
req.flush({ data: [] });
}
}
};
});

View File

@ -96,6 +96,7 @@ export class AuthServiceMock {
language: 'en'
};
authenticate () { return new BehaviorSubject(true); }
updateUser () { }
}

View File

@ -73,7 +73,7 @@ describe('AutoActionsService', () => {
} else {
req.flush({ data: [] });
}
}
};
});

View File

@ -89,7 +89,7 @@ describe('BoardAdminService', () => {
} else {
req.flush({ data: [] });
}
}
};
});

View File

@ -124,7 +124,7 @@ describe('SettingsService', () => {
} else {
req.flush({ data: [] });
}
}
};
});

View File

@ -19,7 +19,7 @@ import { User } from '../../../../src/app/shared/models';
import { SettingsServiceMock, AuthServiceMock } from '../../mocks';
import {
UserDisplay
UserDisplay, ModalUser
} from '../../../../src/app/settings/user-admin/user-admin.models';
import {
UserAdmin
@ -94,6 +94,9 @@ describe('UserAdmin', () => {
(<any>component.userService).editUser = () => {
return { subscribe: fn => {
const user = new User();
user.board_access = [1];
const mUser = new ModalUser(user);
fn({ status: 'success',
alerts: [{}],
data: [{}, JSON.stringify([user])] });

View File

@ -89,7 +89,7 @@ describe('UserAdminService', () => {
} else {
req.flush({ data: [] });
}
}
};
});

View File

@ -40,7 +40,7 @@ describe('UserSettingsService', () => {
it('changes default board', () => {
service.changeDefaultBoard(<any>{}).subscribe(response => {
expect(response.data.length).toEqual(2);
expect(response.data.length).toEqual(3);
});
testCall('api/users/1', 'POST');
@ -56,7 +56,7 @@ describe('UserSettingsService', () => {
it('changes password', () => {
service.changePassword('', '').subscribe(response => {
expect(response.data.length).toEqual(2);
expect(response.data.length).toEqual(3);
});
testCall('api/users/1', 'POST');
@ -70,37 +70,53 @@ describe('UserSettingsService', () => {
testCall('api/users/1', 'POST', true);
});
// it('changes username', () => {
// service.changeUsername('').subscribe(response => {
// expect(response.data.length).toEqual(2);
// });
//
// testCall('api/users/1', 'POST');
// });
//
// it('handles errors on change username', () => {
// service.changeUsername('').subscribe(() => {}, response => {
// expect(response.alerts.length).toEqual(1);
// });
//
// testCall('api/users/1', 'POST', true);
// });
it('changes username', () => {
service.changeUsername('').subscribe(response => {
expect(response.data.length).toEqual(3);
});
// it('changes email', () => {
// service.changeEmail('').subscribe(response => {
// expect(response.data.length).toEqual(2);
// });
//
// testCall('api/users/1', 'POST');
// });
//
// it('handles errors on change email', () => {
// service.changeEmail('').subscribe(() => {}, response => {
// expect(response.alerts.length).toEqual(1);
// });
//
// testCall('api/users/1', 'POST', true);
// });
testCall('api/users/1', 'POST');
});
it('handles errors on change username', () => {
service.changeUsername('').subscribe(() => {}, response => {
expect(response.alerts.length).toEqual(1);
});
testCall('api/users/1', 'POST', true);
});
it('changes email', () => {
service.changeEmail('').subscribe(response => {
expect(response.data.length).toEqual(3);
});
testCall('api/users/1', 'POST');
});
it('handles errors on change email', () => {
service.changeEmail('').subscribe(() => {}, response => {
expect(response.alerts.length).toEqual(1);
});
testCall('api/users/1', 'POST', true);
});
it('changes user options', () => {
service.changeUserOptions(<any>{}).subscribe(response => {
expect(response.data.length).toEqual(3);
});
testCall('api/users/1/opts', 'POST');
});
it('handles errors on change user options', () => {
service.changeUserOptions(<any>{}).subscribe(() => {}, response => {
expect(response.alerts.length).toEqual(1);
});
testCall('api/users/1/opts', 'POST', true);
});
const testCall = (url, method, isError = false) => {
const req = httpMock.expectOne(url);
@ -109,9 +125,9 @@ describe('UserSettingsService', () => {
if (isError) {
req.flush({ alerts: [{}], data: [] }, { status: 500, statusText: '' });
} else {
req.flush({ data: [{}, {}] });
req.flush({ data: [{}, '{}', '{}'] });
}
}
};
});

View File

@ -1,19 +0,0 @@
/* global expect AuthServiceMock */
var path = '../../../../build/shared/auth/',
AuthGuard = require(path + 'auth.guard.js').AuthGuard;
describe('AuthGuard', () => {
var authGuard;
beforeEach(() => {
authGuard = new AuthGuard(AuthServiceMock);
});
it('checks a route can activate via the auth service', done => {
authGuard.canActivate().subscribe(isAuth => {
expect(isAuth).to.equal(true);
done();
});
});
});

View File

@ -0,0 +1,38 @@
import { TestBed, getTestBed } from '@angular/core/testing'
import { AuthGuard } from '../../../../src/app/shared/auth/auth.guard';
import { AuthService } from '../../../../src/app/shared/services';
import { AuthServiceMock } from '../../mocks';
describe('AuthGuard', () => {
let injector: TestBed;
let service: AuthGuard;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
AuthGuard,
{ provide: AuthService, useClass: AuthServiceMock }
]
});
injector = getTestBed();
service = injector.get(AuthGuard);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
it('implements CanActivate', () => {
let actual = false;
service.canActivate().subscribe(value => actual = value);
expect(actual).toEqual(true);
});
});

View File

@ -1,44 +0,0 @@
/* global expect ConstantsMock, HttpMock, RouterMock, StringsServiceMock */
var path = '../../../../build/shared/auth/',
AuthService = require(path + 'auth.service.js').AuthService;
describe('AuthService', () => {
var authService;
beforeEach(() => {
authService = new AuthService(ConstantsMock,
HttpMock, new RouterMock(), StringsServiceMock);
});
it('has userOptions', () => {
expect(authService.userOptions).to.equal(null);
});
it('has userChanged observable', () => {
expect(authService.userChanged).to.be.an('object');
});
it('calls the API to authenticate a JWT', done => {
authService.authenticate().subscribe(test => {
expect(test).to.equal(true);
done();
});
});
it('calls the API to log in', done => {
authService.login('user', 'pass', false).subscribe(res => {
expect(res.status).to.equal('success');
expect(res.endpoint).to.equal('api/login');
done();
});
});
it('calls the API to log out', done => {
authService.logout().subscribe(res => {
expect(res.status).to.equal('success');
expect(res.endpoint).to.equal('api/logout');
done();
});
});
});

View File

@ -0,0 +1,106 @@
import { TestBed, getTestBed } from '@angular/core/testing'
import {
HttpClientTestingModule,
HttpTestingController
} from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { Constants } from '../../../../src/app/shared/constants';
import { StringsService } from '../../../../src/app/shared/services';
import { AuthService } from '../../../../src/app/shared/auth/auth.service';
describe('AuthService', () => {
let injector: TestBed;
let service: AuthService;
let httpMock: HttpTestingController;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
HttpClientTestingModule,
RouterTestingModule.withRoutes([])
],
providers: [
Constants,
StringsService,
AuthService
]
});
injector = getTestBed();
service = injector.get(AuthService);
httpMock = injector.get(HttpTestingController);
});
afterEach(() => {
httpMock.verify();
})
it('should be created', () => {
expect(service).toBeTruthy();
});
it('updates a user', () => {
let actual = false;
service.userChanged.subscribe(() => actual = true);
service.updateUser(<any>{}, <any>{ id: 1 });
expect(actual).toEqual(true);
httpMock.expectOne('strings/en.json');
});
it('authenticates a user', () => {
service.authenticate().subscribe(response => {
expect(response).toEqual(true);
});
testCall('api/authenticate', 'POST');
});
it('handles errors on authenticate', () => {
service.authenticate().subscribe(response => {
expect(response).toEqual(false);
});
testCall('api/authenticate', 'POST', true);
});
it('logs in a user', () => {
service.login('test', 'test', true).subscribe(response => {
expect(response.data.length).toEqual(2);
});
testCall('api/login', 'POST');
});
it('handles errors on user login', () => {
service.login('test', 'test', true).subscribe(() => {}, response => {
expect(response.alerts.length).toEqual(1);
});
testCall('api/login', 'POST', true);
});
it('logs out a user', () => {
service.logout().subscribe(response => {
expect(response.data.length).toEqual(2);
});
testCall('api/logout', 'POST');
});
const testCall = (url, method, isError = false) => {
const req = httpMock.expectOne(url);
expect(req.request.method).toEqual(method);
if (isError) {
req.flush({ alerts: [{}] }, { status: 500, statusText: '' });
} else {
req.flush({ data: [{}, {}] });
}
};
});

View File

@ -1,28 +0,0 @@
/* global expect RxJs */
var path = '../../../../build/shared/compile/',
CompileDirective = require(path + 'compile.directive.js').CompileDirective;
describe('CompileDirective', () => {
var compile,
vcRef = {
clear: () => {},
createComponent: () => {}
},
compiler = {
compileModuleAndAllComponentsAsync: () => {
return RxJs.Observable.of({ componentFactories: [] }).toPromise();
}
};
beforeEach(() => {
compile = new CompileDirective(vcRef, compiler);
compile.compile = '<div></div>';
});
it('implements OnChanges', () => {
compile.ngOnChanges();
expect(compile.compRef).to.equal(null);
});
});

View File

@ -1,32 +0,0 @@
/* global expect ElementRefMock ContextMenuServiceMock SanitizerMock */
var path = '../../../../build/shared/context-menu/',
ContextMenu = require(path + 'context-menu.component.js').ContextMenu;
describe('ContextMenu', () => {
var contextMenu,
contextMenuService,
event = { preventDefault: () => {}, stopPropagation: () => {}};
beforeEach(() => {
contextMenuService = new ContextMenuServiceMock();
contextMenu = new ContextMenu(ElementRefMock, contextMenuService, SanitizerMock);
});
it('has a function to get menu item text', () => {
expect(contextMenu.getText({ text: 'testing' })).to.equal('testing');
});
it('captures the parent oncontextmenu event', done => {
contextMenuService.closeAllCalled.subscribe( called => {
expect(called).to.equal(true);
done();
});
contextMenu.parentEventHandler({
pageX: 10, pageY: 10,
preventDefault: () => {},
stopPropagation: () => {}
});
});
});

View File

@ -0,0 +1,66 @@
import { TestBed, ComponentFixture } from '@angular/core/testing'
import { ElementRef } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { SharedModule } from '../../../../src/app/shared/shared.module';
import {
ContextMenuService
} from '../../../../src/app/shared/context-menu/context-menu.service';
import {
ContextMenu
} from '../../../../src/app/shared/context-menu/context-menu.component';
class ElementRefMock {
public nativeElement = { parentElement: {} };
}
describe('ContextMenu', () => {
let component: ContextMenu,
fixture: ComponentFixture<ContextMenu>,
elementRef: ElementRefMock;
const getPrivateFunction = name => component[name].bind(component);
beforeEach(() => {
elementRef = new ElementRefMock();
TestBed.configureTestingModule({
imports: [ SharedModule ],
providers: [
ContextMenuService,
{ provide: ElementRef, useValue: elementRef }
]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ContextMenu);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('can be constructed', () => {
expect(component).toBeTruthy();
});
it('captures parent oncontextmenu events', () => {
let parentElement = component.el.nativeElement.parentElement;
expect(parentElement.oncontextmenu).toEqual(jasmine.any(Function));
parentElement.oncontextmenu({
preventDefault: () => {},
stopPropagation: () => {}
});
});
it('gets HTML formatted text from items', () => {
let actual = component.getText(<any>{ text: '<p>Test</p>' });
expect((<any>actual).changingThisBreaksApplicationSecurity)
.toEqual('<p>Test</p>');
});
});

View File

@ -1,30 +0,0 @@
/* global expect */
var path = '../../../../build/shared/context-menu/',
ContextMenuItem = require(path + 'context-menu-item.model.js').ContextMenuItem,
ContextMenuService = require(path + 'context-menu.service.js').ContextMenuService;
describe('ContextMenu', () => {
var contextMenuService;
beforeEach(() => {
contextMenuService = new ContextMenuService();
});
it('has a menus array', () => {
expect(contextMenuService.menus).to.be.an('array');
});
it('has a registerMenu function', () => {
contextMenuService.registerMenu(new ContextMenuItem());
expect(contextMenuService.menus.length).to.equal(1);
});
it('has a closeAllMenus function', () => {
contextMenuService.registerMenu({ isOpen: true });
contextMenuService.closeAllMenus({});
expect(contextMenuService.menus[0].isOpen).to.equal(false);
});
});

View File

@ -0,0 +1,37 @@
import {
ContextMenuService
} from '../../../../src/app/shared/context-menu/context-menu.service';
describe('ContextMenuService', () => {
let service: ContextMenuService;
beforeEach(() => {
service = new ContextMenuService();
});
it('can be constructed', () => {
expect(service).toBeTruthy();
});
it('can have a menu registered', () => {
service.registerMenu(<any>{});
expect(service['menus'].length).toEqual(1);
});
it('has a way to close all menus', () => {
service.registerMenu(<any>{ isOpen: true });
service.closeAllMenus();
expect(service['menus'][0].isOpen).toEqual(false);
});
it('closes all menus on document click', () => {
service.registerMenu(<any>{ isOpen: true });
document.body.click();
expect(service['menus'][0].isOpen).toEqual(false);
});
});

View File

@ -1,42 +0,0 @@
/* global expect */
var path = '../../../../build/shared/inline-edit/',
InlineEdit = require(path + 'inline-edit.component.js').InlineEdit;
describe('InlineEdit', () => {
var inlineEdit;
beforeEach(() => {
inlineEdit = new InlineEdit();
});
it('has a beginEdit method', done => {
expect(inlineEdit.beginEdit).to.be.a('function');
var called = false,
el = {
focus: () => {
called = true;
}
};
inlineEdit.beginEdit(el);
expect(inlineEdit.isDisplay).to.equal(false);
setTimeout(() => {
expect(called).to.equal(true);
done();
}, 110);
});
it('has an editDone function', done => {
expect(inlineEdit.editDone).to.be.a('function');
inlineEdit.edit.subscribe(text => {
expect(text).to.equal('test');
done();
});
inlineEdit.editDone('test', { stopPropagation: () => {} });
});
});

View File

@ -0,0 +1,57 @@
import { TestBed, ComponentFixture } from '@angular/core/testing'
import { SharedModule } from '../../../../src/app/shared/shared.module';
import {
InlineEdit
} from '../../../../src/app/shared/inline-edit/inline-edit.component';
describe('InlineEdit', () => {
let component: InlineEdit,
fixture: ComponentFixture<InlineEdit>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ SharedModule ]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(InlineEdit);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('can be constructed', () => {
expect(component).toBeTruthy();
});
it('toggles display for edit mode', done => {
expect(component.isDisplay).toEqual(true);
let called = false;
const el = { focus: () => called = true };
component.beginEdit(<any>el);
expect(component.isDisplay).toEqual(false);
setTimeout(() => {
expect(called).toEqual(true);
done();
}, 110);
});
it('updates values when editing is complete', () => {
let called = false;
const event = { stopPropagation: () => called = true };
component.editDone('test');
component.editDone('test', <any>event);
expect(called).toEqual(true);
expect(component.isDisplay).toEqual(true);
expect(component.text).toEqual('test');
});
});

View File

@ -1,66 +0,0 @@
/* global expect ModalServiceMock */
var path = '../../../../build/shared/modal/',
Modal = require(path + 'modal.component.js').Modal;
describe('Modal', () => {
var modal,
modalService;
beforeEach(() => {
modalService = new ModalServiceMock();
modal = new Modal(modalService);
});
it('has modalId property', () => {
expect(modal.modalId).to.be.a('string');
});
it('has modalTitle property', () => {
expect(modal.modalTitle).to.be.a('string');
});
it('has blocking property', () => {
expect(modal.blocking).to.be.a('boolean');
});
it('has isOpen property', () => {
expect(modal.isOpen).to.be.a('boolean');
});
it('registers itself with the modal service on init', done => {
modalService.registerCalled.subscribe(called => {
expect(called).to.equal(true);
done();
});
modal.ngOnInit();
});
it('calls the close function on the service', done => {
modalService.closeCalled.subscribe(called => {
expect(called).to.equal(true);
done();
});
modal.close();
});
it('calls close on Escape keypress', done => {
modalService.closeCalled.subscribe(called => {
expect(called).to.equal(true);
done();
});
modal.keyup({ keyCode: 27 });
});
it('filters clicks on the modal to prevent closing', () => {
var stopCalled = false,
eventStop = {
stopPropagation: () => {
stopCalled = true;
}
};
modal.filterClick(eventStop);
expect(stopCalled).to.equal(true);
});
});

View File

@ -0,0 +1,67 @@
import { TestBed, ComponentFixture } from '@angular/core/testing'
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { FormsModule } from '@angular/forms';
import { SharedModule } from '../../../../src/app/shared/shared.module';
import { ModalService } from '../../../../src/app/shared/services';
import { Modal } from '../../../../src/app/shared/modal/modal.component';
fdescribe('Modal', () => {
let component: Modal,
fixture: ComponentFixture<Modal>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
HttpClientTestingModule,
FormsModule,
SharedModule
],
providers: [ ModalService ]
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(Modal);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('can be constructed', () => {
expect(component).toBeTruthy();
});
it('calls the modal service to close', () => {
component.modalId = 'MODAL';
(<any>component.modalService).close = (id, checkBlocking) => {
expect(id).toEqual('MODAL');
expect(checkBlocking).toEqual(false);
};
component.close();
(<any>component.modalService).close = (id, checkBlocking) => {
expect(id).toEqual('MODAL');
expect(checkBlocking).toEqual(true);
};
component.close(true);
});
it('filters click events', () => {
window.event = <any>{};
component.filterClick(null);
let called = false;
const event = { stopPropagation: () => called = true };
component.filterClick(<any>event);
expect(called).toEqual(true);
});
});

View File

@ -1,62 +0,0 @@
/* globals expect AuthServiceMock */
var path = '../../../../build/shared/modal/',
ModalService = require(path + 'modal.service.js').ModalService;
describe('ModalService', () => {
var modalService,
modal;
beforeEach(() => {
modalService = new ModalService(AuthServiceMock);
modal = {
modalId: 'testModal',
isOpen: false,
focusElement: {
nativeElement: {
focus: () => {}
}
}
};
});
it('has an array of modals', () => {
expect(modalService.modals).to.be.an('array');
expect(modalService.modals.length).to.equal(0);
});
it('has a function to register a modal', () => {
expect(modalService.registerModal).to.be.a('function');
modalService.registerModal(modal);
expect(modalService.modals[0].modalId).to.equal(modal.modalId);
});
it('will not register the same modal twice', () => {
modalService.registerModal(modal);
expect(modalService.modals.length).to.equal(1);
modalService.registerModal(modal);
expect(modalService.modals.length).to.equal(1);
});
it('has a function to open a modal', () => {
modalService.registerModal(modal);
modalService.open(modal.modalId);
expect(modalService.modals[0].isOpen).to.equal(true);
});
it('has a function to close a modal', () => {
modal.isOpen = true;
modalService.registerModal(modal);
modalService.close(modal.modalId);
expect(modalService.modals[0].isOpen).to.equal(false);
modalService.modals[0].isOpen = true;
modal.blocking = true;
modalService.close(modal.modalId, true);
expect(modalService.modals[0].isOpen).to.equal(true);
});
});