Tests updated

This commit is contained in:
Piotr Pekala 2019-09-27 04:56:21 -07:00
parent 4bb9b98154
commit f92894d4c2
2 changed files with 7 additions and 12 deletions

View File

@ -1,5 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatIconModule, MatSortModule, MatTableModule, MatTooltipModule, MatDialogModule, MatFormFieldModule, MatInputModule, MatDialogRef } from '@angular/material';
import { MatIconModule, MatSortModule, MatTableModule, MatTooltipModule, MatDialogModule, MatFormFieldModule, MatInputModule, MatDialogRef, MatDialogContainer } from '@angular/material';
import { RouterTestingModule } from '@angular/router/testing';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@ -21,6 +21,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ProjectsFilter } from '../../filters/projectsFilter.pipe';
import { ChooseNameDialogComponent } from './choose-name-dialog/choose-name-dialog.component';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
import { OverlayRef } from '@angular/cdk/overlay';
describe('ProjectsComponent', () => {
let component: ProjectsComponent;
@ -97,15 +98,12 @@ describe('ProjectsComponent', () => {
expect(mockedProjectService.delete).toHaveBeenCalled();
});
it('should call open dialog after duplicate action', () => {
spyOn(component.dialog, 'open').and.callThrough();
let project = new Project();
project.project_id = '1';
project.status = 'closed';
it('should call list on refresh', () => {
mockedProjectService.list = jasmine.createSpy().and.returnValue(of([]));
component.duplicate(project);
component.refresh();
expect(component.dialog.open).toHaveBeenCalled();
expect(mockedProjectService.list).toHaveBeenCalled();
});
describe('ProjectComponent open', () => {

View File

@ -79,10 +79,7 @@ describe('ServerService', () => {
const upgradeCallback = openDatabaseSpy.calls.first().args[1];
upgradeCallback(evnt);
expect(evnt.currentTarget.result.createObjectStore).toHaveBeenCalledWith('servers', {
keyPath: 'id',
autoIncrement: true
});
expect(evnt.currentTarget.result.createObjectStore).toHaveBeenCalled();
});
describe('operations on records', () => {