mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-01-11 17:44:32 +00:00
Fixes failing tests
This commit is contained in:
parent
91f5a3782a
commit
b42a5750c0
@ -3,11 +3,14 @@ import {HttpClientTestingModule, HttpTestingController} from '@angular/common/ht
|
|||||||
import {DebugNode} from '@angular/core';
|
import {DebugNode} from '@angular/core';
|
||||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {MatDialogModule} from '@angular/material/dialog';
|
||||||
import {MatFormFieldModule} from '@angular/material/form-field';
|
import {MatFormFieldModule} from '@angular/material/form-field';
|
||||||
import {MatIconModule} from '@angular/material/icon';
|
import {MatIconModule} from '@angular/material/icon';
|
||||||
import {MatInputModule} from '@angular/material/input';
|
import {MatInputModule} from '@angular/material/input';
|
||||||
import {MatMenuModule} from '@angular/material/menu';
|
import {MatMenuModule} from '@angular/material/menu';
|
||||||
|
import {MatSnackBarModule} from '@angular/material/snack-bar';
|
||||||
import {MatToolbarModule} from '@angular/material/toolbar';
|
import {MatToolbarModule} from '@angular/material/toolbar';
|
||||||
|
import {MatTooltipModule} from '@angular/material/tooltip';
|
||||||
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
|
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
import {BPMN_DIAGRAM, BPMN_DIAGRAM_WITH_WARNINGS} from '../testing/mocks/diagram.mocks';
|
import {BPMN_DIAGRAM, BPMN_DIAGRAM_WITH_WARNINGS} from '../testing/mocks/diagram.mocks';
|
||||||
import {BpmnWarning} from './_interfaces/bpmn-warning';
|
import {BpmnWarning} from './_interfaces/bpmn-warning';
|
||||||
@ -30,10 +33,13 @@ describe('AppComponent', () => {
|
|||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
NoopAnimationsModule,
|
NoopAnimationsModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
|
MatDialogModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatInputModule,
|
MatInputModule,
|
||||||
MatMenuModule,
|
MatMenuModule,
|
||||||
|
MatSnackBarModule,
|
||||||
MatToolbarModule,
|
MatToolbarModule,
|
||||||
|
MatTooltipModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
HttpClientTestingModule,
|
HttpClientTestingModule,
|
||||||
@ -85,8 +91,7 @@ describe('AppComponent', () => {
|
|||||||
it('loads a diagram from URL', () => {
|
it('loads a diagram from URL', () => {
|
||||||
component.diagramUrl = 'some-url';
|
component.diagramUrl = 'some-url';
|
||||||
component.openMethod = 'url';
|
component.openMethod = 'url';
|
||||||
const event = new MouseEvent('click');
|
component['onSubmitFileToOpen']();
|
||||||
component['onSubmit'](event);
|
|
||||||
|
|
||||||
const sReq = httpMock.expectOne(component.diagramUrl);
|
const sReq = httpMock.expectOne(component.diagramUrl);
|
||||||
expect(sReq.request.method).toEqual('GET');
|
expect(sReq.request.method).toEqual('GET');
|
||||||
@ -96,8 +101,7 @@ describe('AppComponent', () => {
|
|||||||
it('loads a diagram from URL with warnings', () => {
|
it('loads a diagram from URL with warnings', () => {
|
||||||
component.diagramUrl = 'some-url';
|
component.diagramUrl = 'some-url';
|
||||||
component.openMethod = 'url';
|
component.openMethod = 'url';
|
||||||
const event = new MouseEvent('click');
|
component['onSubmitFileToOpen']();
|
||||||
component['onSubmit'](event);
|
|
||||||
|
|
||||||
const sReq = httpMock.expectOne(component.diagramUrl);
|
const sReq = httpMock.expectOne(component.diagramUrl);
|
||||||
expect(sReq.request.method).toEqual('GET');
|
expect(sReq.request.method).toEqual('GET');
|
||||||
@ -109,8 +113,7 @@ describe('AppComponent', () => {
|
|||||||
const newFile = new File([BPMN_DIAGRAM], 'filename.xml', {type: 'text/xml'});
|
const newFile = new File([BPMN_DIAGRAM], 'filename.xml', {type: 'text/xml'});
|
||||||
component.diagramFile = newFile;
|
component.diagramFile = newFile;
|
||||||
component.openMethod = 'file';
|
component.openMethod = 'file';
|
||||||
const event = new MouseEvent('click');
|
component['onSubmitFileToOpen']();
|
||||||
component['onSubmit'](event);
|
|
||||||
expect(readFileSpy).toHaveBeenCalledWith(newFile);
|
expect(readFileSpy).toHaveBeenCalledWith(newFile);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -135,8 +138,7 @@ describe('AppComponent', () => {
|
|||||||
|
|
||||||
component.diagramFile = new File([], 'filename.jpg', {type: 'image/jpeg'});
|
component.diagramFile = new File([], 'filename.jpg', {type: 'image/jpeg'});
|
||||||
component.openMethod = 'file';
|
component.openMethod = 'file';
|
||||||
const event = new MouseEvent('click');
|
component['onSubmitFileToOpen']();
|
||||||
component['onSubmit'](event);
|
|
||||||
const expectedParams = {
|
const expectedParams = {
|
||||||
type: 'error',
|
type: 'error',
|
||||||
error: new Error('Wrong file type. Please choose a BPMN XML file.')
|
error: new Error('Wrong file type. Please choose a BPMN XML file.')
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
|
||||||
|
import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material/dialog';
|
||||||
|
import {MatFormFieldModule} from '@angular/material/form-field';
|
||||||
|
import {MatInputModule} from '@angular/material/input';
|
||||||
|
import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations';
|
||||||
|
|
||||||
import {NewFileDialogComponent} from './new-file-dialog.component';
|
import {NewFileDialogComponent} from './new-file-dialog.component';
|
||||||
|
|
||||||
@ -8,7 +13,26 @@ describe('NewFileDialogComponent', () => {
|
|||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ NewFileDialogComponent ]
|
declarations: [NewFileDialogComponent],
|
||||||
|
imports: [
|
||||||
|
BrowserAnimationsModule,
|
||||||
|
FormsModule,
|
||||||
|
MatDialogModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
NoopAnimationsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: MatDialogRef,
|
||||||
|
useValue: {
|
||||||
|
close: (dialogResult: any) => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{provide: MAT_DIALOG_DATA, useValue: []},
|
||||||
|
]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
}));
|
}));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user