BPMN reorder tests passing

This commit is contained in:
alicia pritchett 2021-09-10 12:49:38 -04:00
parent 66e95c0f04
commit dbdd79fb9a
1 changed files with 18 additions and 26 deletions

View File

@ -15,7 +15,7 @@ import {of} from 'rxjs';
import { import {
ApiErrorsComponent, ApiErrorsComponent,
ApiService, ApiService,
MockEnvironment, MockEnvironment, mockWorkflowMeta1,
mockWorkflowSpec0, mockWorkflowSpec0,
mockWorkflowSpec1, mockWorkflowSpec1,
mockWorkflowSpec2, mockWorkflowSpec2,
@ -36,7 +36,7 @@ import {
} from '../_interfaces/dialog-data'; } from '../_interfaces/dialog-data';
import {GetIconCodePipe} from '../_pipes/get-icon-code.pipe'; import {GetIconCodePipe} from '../_pipes/get-icon-code.pipe';
import {FileListComponent} from '../file-list/file-list.component'; import {FileListComponent} from '../file-list/file-list.component';
import {WorkflowSpecListComponent} from './workflow-spec-list.component'; import {WorkflowSpecCategoryGroup, WorkflowSpecListComponent} from './workflow-spec-list.component';
export class MdDialogMock { export class MdDialogMock {
@ -476,33 +476,25 @@ describe('WorkflowSpecListComponent', () => {
}); });
*/ */
it('should update all category display orders', () => { it('should update a single category display order', () => {
const editCategoryDisplayOrderSpy = spyOn((component as any), 'editCategoryDisplayOrder').and.stub(); mockWorkflowSpecCategory1.id = 5;
(component as any).editCategoryDisplayOrder(mockWorkflowSpecCategory1.id, 'down');
mockWorkflowSpecCategories.forEach((cat, i) => { let results = { param: 'direction', value: 'down' };
let results = { param: 'direction', value: 'down' }; const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${mockWorkflowSpecCategory1.id}/reorder?${results.param}=${results.value}`);
const req = httpMock.expectOne(`apiRoot/workflow-specification-category/${cat.id}/reorder?${results.param}=${results.value}`); expect(req.request.method).toEqual('PUT');
expect(req.request.method).toEqual('PUT'); req.flush(mockWorkflowSpecCategory1);
req.flush(mockWorkflowSpecCategories[i]);
});
expect(editCategoryDisplayOrderSpy).toHaveBeenCalled();
}); });
/**
it('should update all spec display orders', () => { it('should update a single spec display order', () => {
const _loadWorkflowSpecCategoriesSpy = spyOn((component as any), '_loadWorkflowSpecCategories').and.stub(); let wfs_group: WorkflowSpecCategoryGroup[] = [];
mockWorkflowSpecCategory1.workflows.push(mockWorkflowMeta1);
mockWorkflowSpecs.forEach((spec, i) => { wfs_group.push(mockWorkflowSpecCategory1);
const req = httpMock.expectOne(`apiRoot/workflow-specification/${spec.id}`); (component as any).editSpecDisplayOrder(wfs_group[0], mockWorkflowSpec1.id, 'down');
expect(req.request.method).toEqual('PUT'); let results = { param: 'direction', value: 'down' };
req.flush(mockWorkflowSpecs[i]); const req = httpMock.expectOne(`apiRoot/workflow-specification/${mockWorkflowSpec1.id}/reorder?${results.param}=${results.value}`);
}); expect(req.request.method).toEqual('PUT');
req.flush(mockWorkflowSpecCategory1);
expect(_loadWorkflowSpecCategoriesSpy).toHaveBeenCalled();
}); });
*/
it('should load master workflow spec', () => { it('should load master workflow spec', () => {