Remove mocha and jasmine-ajax dependencies (#11813)

This commit is contained in:
Denys Vuika
2026-04-16 10:20:49 +01:00
committed by GitHub
parent b550712160
commit 6fc8dda887
31 changed files with 926 additions and 1807 deletions
+3 -9
View File
@@ -29,7 +29,7 @@ module.exports = function (config) {
{ pattern: 'lib/config/app.config.json', included: false, served: true, watched: false } { pattern: 'lib/config/app.config.json', included: false, served: true, watched: false }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
proxies: { proxies: {
'/assets/images/': '/base/lib/core/src/lib/assets/images/', '/assets/images/': '/base/lib/core/src/lib/assets/images/',
@@ -42,13 +42,11 @@ module.exports = function (config) {
}, },
plugins: [ plugins: [
require('karma-jasmine-ajax'),
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false, clearContext: false,
@@ -61,10 +59,6 @@ module.exports = function (config) {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/content-services'), dir: join(__dirname, '../../coverage/content-services'),
subdir: '.', subdir: '.',
@@ -86,7 +80,7 @@ module.exports = function (config) {
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
@@ -26,8 +26,6 @@ import { FileModel, FileUploadStatus } from '../../common/models/file.model';
import { AlfrescoApiService } from '../../services'; import { AlfrescoApiService } from '../../services';
import { AlfrescoApiServiceMock } from '../../mock'; import { AlfrescoApiServiceMock } from '../../mock';
declare let jasmine: any;
describe('UploadService', () => { describe('UploadService', () => {
let service: UploadService; let service: UploadService;
let appConfigService: AppConfigService; let appConfigService: AppConfigService;
@@ -35,6 +33,40 @@ describe('UploadService', () => {
const mockProductInfo = new BehaviorSubject<RepositoryInfo>(null); const mockProductInfo = new BehaviorSubject<RepositoryInfo>(null);
const createMockPromiseWithEvents = (responseData?: any, shouldError = false) => {
const handlers: any = {};
const promise: any = new Promise((resolve, reject) => {
setTimeout(() => {
if (shouldError) {
if (handlers.error) {
handlers.error(responseData || { status: 404 });
}
reject(responseData);
} else {
if (handlers.success) {
handlers.success(responseData);
}
resolve(responseData);
}
}, 0);
});
promise.on = (event: string, handler: (data?: any) => void) => {
handlers[event] = handler;
return promise;
};
promise.abort = () => {
if (handlers.abort) {
handlers.abort();
}
};
promise.catch = (handler: (error: any) => void) => Promise.prototype.catch.call(promise, handler);
return promise;
};
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [], imports: [],
@@ -75,14 +107,9 @@ describe('UploadService', () => {
uploadFileSpy = spyOn(service.uploadApi, 'uploadFile').and.callThrough(); uploadFileSpy = spyOn(service.uploadApi, 'uploadFile').and.callThrough();
jasmine.Ajax.install();
mockProductInfo.next({ status: { isThumbnailGenerationEnabled: true } } as RepositoryInfo); mockProductInfo.next({ status: { isThumbnailGenerationEnabled: true } } as RepositoryInfo);
}); });
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should return an empty queue if no elements are added', () => { it('should return an empty queue if no elements are added', () => {
expect(service.getQueue().length).toEqual(0); expect(service.getQueue().length).toEqual(0);
}); });
@@ -153,53 +180,49 @@ describe('UploadService', () => {
it('should make XHR done request after the file is added in the queue', (done) => { it('should make XHR done request after the file is added in the queue', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockResponse = { entry: { id: 'node-id' } };
const mockPromise = createMockPromiseWithEvents(mockResponse);
uploadFileSpy.and.returnValue(mockPromise);
const emitterDisposable = emitter.subscribe((e) => { const emitterDisposable = emitter.subscribe((e) => {
expect(e.value).toBe('File uploaded'); expect(e.value).toEqual(mockResponse);
emitterDisposable.unsubscribe(); emitterDisposable.unsubscribe();
done(); done();
}); });
const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, { parentId: '-root-', path: 'fake-dir' }); const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, { parentId: '-root-', path: 'fake-dir' });
service.addToQueue(fileFake); service.addToQueue(fileFake);
service.uploadFilesInTheQueue(emitter); service.uploadFilesInTheQueue(emitter);
const request = jasmine.Ajax.requests.mostRecent(); expect(uploadFileSpy).toHaveBeenCalled();
expect(request.url).toBe(
'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true&include=allowableOperations'
);
expect(request.method).toBe('POST');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: 'File uploaded'
});
}); });
it('should make XHR error request after an error occur', (done) => { it('should make XHR error request after an error occur', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockPromise = createMockPromiseWithEvents({ status: 404 }, true);
uploadFileSpy.and.returnValue(mockPromise);
const emitterDisposable = emitter.subscribe((e) => { const emitterDisposable = emitter.subscribe((e) => {
expect(e.value).toBe('Error file uploaded'); expect(e.value).toBe('Error file uploaded');
emitterDisposable.unsubscribe(); emitterDisposable.unsubscribe();
done(); done();
}); });
const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, { parentId: '-root-' }); const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, { parentId: '-root-' });
service.addToQueue(fileFake); service.addToQueue(fileFake);
service.uploadFilesInTheQueue(null, emitter); service.uploadFilesInTheQueue(null, emitter);
expect(jasmine.Ajax.requests.mostRecent().url).toBe(
'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true&include=allowableOperations'
);
jasmine.Ajax.requests.mostRecent().respondWith({ expect(uploadFileSpy).toHaveBeenCalled();
status: 404,
contentType: 'text/plain',
responseText: 'Error file uploaded'
});
}); });
it('should abort file only if it is safe to abort', (done) => { it('should abort file only if it is safe to abort', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockPromise = createMockPromiseWithEvents();
uploadFileSpy.and.returnValue(mockPromise);
const emitterDisposable = emitter.subscribe((event) => { const emitterDisposable = emitter.subscribe((event) => {
expect(event.value).toEqual('File aborted'); expect(event.value).toEqual('File aborted');
emitterDisposable.unsubscribe(); emitterDisposable.unsubscribe();
@@ -217,22 +240,18 @@ describe('UploadService', () => {
it('should let file complete and then delete node if it is not safe to abort', (done) => { it('should let file complete and then delete node if it is not safe to abort', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockUploadResponse = { entry: { id: 'myNodeId' } };
const mockPromise = createMockPromiseWithEvents(mockUploadResponse);
uploadFileSpy.and.returnValue(mockPromise);
const deleteNodeSpy = spyOn(service.nodesApi, 'deleteNode').and.returnValue(Promise.resolve());
const emitterDisposable = emitter.subscribe((event) => { const emitterDisposable = emitter.subscribe((event) => {
expect(event.value).toEqual('File deleted'); if (event.value === 'File deleted') {
emitterDisposable.unsubscribe(); expect(deleteNodeSpy).toHaveBeenCalledWith('myNodeId', { permanent: true });
emitterDisposable.unsubscribe();
const deleteRequest = jasmine.Ajax.requests.mostRecent(); done();
expect(deleteRequest.url).toBe( }
'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/myNodeId?permanent=true'
);
expect(deleteRequest.method).toBe('DELETE');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: 'File deleted'
});
done();
}); });
const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File); const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File);
@@ -241,41 +260,30 @@ describe('UploadService', () => {
const file = service.getQueue(); const file = service.getQueue();
service.cancelUpload(...file); service.cancelUpload(...file);
const request = jasmine.Ajax.requests.mostRecent();
expect(request.url).toBe(
'http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children?autoRename=true&include=allowableOperations'
);
expect(request.method).toBe('POST');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {
entry: {
id: 'myNodeId'
}
}
});
}); });
it('should delete node version when cancelling the upload of the new file version', (done) => { it('should delete node version when cancelling the upload of the new file version', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockUploadResponse = {
entry: {
id: 'myNodeId',
properties: {
'cm:versionLabel': '1.1'
}
}
};
const mockPromise = createMockPromiseWithEvents(mockUploadResponse);
spyOn(service.nodesApi, 'updateNodeContent').and.returnValue(mockPromise);
const deleteVersionSpy = spyOn(service.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve());
const emitterDisposable = emitter.subscribe((event) => { const emitterDisposable = emitter.subscribe((event) => {
expect(event.value).toEqual('File deleted'); if (event.value === 'File deleted') {
emitterDisposable.unsubscribe(); expect(deleteVersionSpy).toHaveBeenCalledWith('myNodeId', '1.1');
emitterDisposable.unsubscribe();
const deleteRequest = jasmine.Ajax.requests.mostRecent(); done();
expect(deleteRequest.url).toBe('http://localhost:9876/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/myNodeId/versions/1.1'); }
expect(deleteRequest.method).toBe('DELETE');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: 'File deleted'
});
done();
}); });
const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, null, 'fakeId'); const fileFake = new FileModel({ name: 'fake-name', size: 10 } as File, null, 'fakeId');
@@ -284,23 +292,6 @@ describe('UploadService', () => {
const file = service.getQueue(); const file = service.getQueue();
service.cancelUpload(...file); service.cancelUpload(...file);
const request = jasmine.Ajax.requests.mostRecent();
expect(request.url).toContain('ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/fakeId/content?include=allowableOperations');
expect(request.method).toBe('PUT');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {
entry: {
id: 'myNodeId',
properties: {
'cm:versionLabel': '1.1'
}
}
}
});
}); });
it('If newVersion is set, name should be a param', () => { it('If newVersion is set, name should be a param', () => {
@@ -331,26 +322,27 @@ describe('UploadService', () => {
it('should use custom root folder ID given to the service', (done) => { it('should use custom root folder ID given to the service', (done) => {
const emitter = new EventEmitter(); const emitter = new EventEmitter();
const mockResponse = { entry: { id: 'node-id' } };
const mockPromise = createMockPromiseWithEvents(mockResponse);
uploadFileSpy.and.returnValue(mockPromise);
const emitterDisposable = emitter.subscribe((e) => { const emitterDisposable = emitter.subscribe((e) => {
expect(e.value).toBe('File uploaded'); expect(e.value).toEqual(mockResponse);
emitterDisposable.unsubscribe(); emitterDisposable.unsubscribe();
done(); done();
}); });
const filesFake = new FileModel({ name: 'fake-file-name', size: 10 } as File, { parentId: '123', path: 'fake-dir' }); const filesFake = new FileModel({ name: 'fake-file-name', size: 10 } as File, { parentId: '123', path: 'fake-dir' });
service.addToQueue(filesFake); service.addToQueue(filesFake);
service.uploadFilesInTheQueue(emitter); service.uploadFilesInTheQueue(emitter);
const request = jasmine.Ajax.requests.mostRecent(); expect(uploadFileSpy).toHaveBeenCalledWith(
expect(request.url).toContain( jasmine.objectContaining({ name: 'fake-file-name' }),
'/ecm/alfresco/api/-default-/public/alfresco/versions/1/nodes/123/children?autoRename=true&include=allowableOperations' 'fake-dir',
'123',
jasmine.any(Object),
jasmine.any(Object)
); );
expect(request.method).toBe('POST');
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'text/plain',
responseText: 'File uploaded'
});
}); });
describe('versioningEnabled', () => { describe('versioningEnabled', () => {
@@ -437,6 +429,13 @@ describe('UploadService', () => {
}); });
it('should start downloading the next one if a file of the list is aborted', (done) => { it('should start downloading the next one if a file of the list is aborted', (done) => {
const mockResponse1 = { entry: { id: 'node-id-1' } };
const mockResponse2 = { entry: { id: 'node-id-2' } };
const mockPromise1 = createMockPromiseWithEvents(mockResponse1);
const mockPromise2 = createMockPromiseWithEvents(mockResponse2);
uploadFileSpy.and.returnValues(mockPromise1, mockPromise2);
service.fileUploadAborted.subscribe((e) => { service.fileUploadAborted.subscribe((e) => {
expect(e).not.toBeNull(); expect(e).not.toBeNull();
}); });
@@ -23,8 +23,6 @@ import { CustomResourcesService } from './custom-resources.service';
import { NodesApiService } from '../../common'; import { NodesApiService } from '../../common';
import { provideApiTesting } from '../../testing/providers'; import { provideApiTesting } from '../../testing/providers';
declare let jasmine: any;
describe('DocumentListService', () => { describe('DocumentListService', () => {
let service: DocumentListService; let service: DocumentListService;
let customResourcesService: CustomResourcesService; let customResourcesService: CustomResourcesService;
@@ -79,7 +77,6 @@ describe('DocumentListService', () => {
service = TestBed.inject(DocumentListService); service = TestBed.inject(DocumentListService);
customResourcesService = TestBed.inject(CustomResourcesService); customResourcesService = TestBed.inject(CustomResourcesService);
nodesApiService = TestBed.inject(NodesApiService); nodesApiService = TestBed.inject(NodesApiService);
jasmine.Ajax.install();
}); });
it('should emit resetSelection$ when resetSelection is called', (done) => { it('should emit resetSelection$ when resetSelection is called', (done) => {
@@ -96,11 +93,9 @@ describe('DocumentListService', () => {
service.reload(); service.reload();
}); });
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should return the folder info', fakeAsync(() => { it('should return the folder info', fakeAsync(() => {
spyOn(service.nodes, 'listNodeChildren').and.returnValue(Promise.resolve(fakeFolder as any));
service.getFolder('/fake-root/fake-name').subscribe((res) => { service.getFolder('/fake-root/fake-name').subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.list).toBeDefined(); expect(res.list).toBeDefined();
@@ -109,12 +104,6 @@ describe('DocumentListService', () => {
expect(res.list.entries[0].entry.isFolder).toBeTruthy(); expect(res.list.entries[0].entry.isFolder).toBeTruthy();
expect(res.list.entries[0].entry.name).toEqual('fake-name'); expect(res.list.entries[0].entry.name).toEqual('fake-name');
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: fakeFolder
});
})); }));
it('should use rootFolderId provided in options', () => { it('should use rootFolderId provided in options', () => {
@@ -204,35 +193,33 @@ describe('DocumentListService', () => {
}); });
}); });
it('should delete the folder', fakeAsync(() => { it('should delete the folder', (done) => {
service.deleteNode('fake-id').subscribe((res) => { spyOn(service.nodes, 'deleteNode').and.returnValue(Promise.resolve() as any);
expect(res).toBe('');
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.deleteNode('fake-id').subscribe(() => {
status: 204, expect(service.nodes.deleteNode).toHaveBeenCalledWith('fake-id');
contentType: 'json' done();
}); });
})); });
it('should copy a node', (done) => { it('should copy a node', (done) => {
service.copyNode('node-id', 'parent-id').subscribe(() => done()); const mockResponse = { entry: { id: 'copied-node-id' } } as NodeEntry;
const copyNodeSpy = spyOn(service.nodes, 'copyNode').and.returnValue(Promise.resolve(mockResponse));
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST'); service.copyNode('node-id', 'parent-id').subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/nodes/node-id/copy'); expect(copyNodeSpy).toHaveBeenCalledWith('node-id', { targetParentId: 'parent-id' });
expect(jasmine.Ajax.requests.mostRecent().params).toEqual(JSON.stringify({ targetParentId: 'parent-id' })); done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json' });
}); });
it('should move a node', (done) => { it('should move a node', (done) => {
service.moveNode('node-id', 'parent-id').subscribe(() => done()); const mockResponse = { entry: { id: 'moved-node-id' } } as NodeEntry;
const moveNodeSpy = spyOn(service.nodes, 'moveNode').and.returnValue(Promise.resolve(mockResponse));
expect(jasmine.Ajax.requests.mostRecent().method).toBe('POST'); service.moveNode('node-id', 'parent-id').subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url).toContain('/nodes/node-id/move'); expect(moveNodeSpy).toHaveBeenCalledWith('node-id', { targetParentId: 'parent-id' });
expect(jasmine.Ajax.requests.mostRecent().params).toEqual(JSON.stringify({ targetParentId: 'parent-id' })); done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ status: 200, contentType: 'json' });
}); });
it('should call isCustomSource from customResourcesService when isCustomSourceService is called', () => { it('should call isCustomSource from customResourcesService when isCustomSourceService is called', () => {
@@ -25,8 +25,6 @@ import { EMPTY, of } from 'rxjs';
import { AlfrescoApiService } from '../../services'; import { AlfrescoApiService } from '../../services';
import { AlfrescoApiServiceMock } from '../../mock'; import { AlfrescoApiServiceMock } from '../../mock';
declare let jasmine: any;
describe('NodeCommentsService', () => { describe('NodeCommentsService', () => {
let service: NodeCommentsService; let service: NodeCommentsService;
@@ -40,15 +38,12 @@ describe('NodeCommentsService', () => {
] ]
}); });
service = TestBed.inject(NodeCommentsService); service = TestBed.inject(NodeCommentsService);
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
}); });
describe('Node comments', () => { describe('Node comments', () => {
it('should add a comment node ', (done) => { it('should add a comment node ', (done) => {
spyOn(service.commentsApi, 'createComment').and.returnValue(Promise.resolve(fakeContentComment as any));
service.add('999', 'fake-comment-message').subscribe((res: CommentModel) => { service.add('999', 'fake-comment-message').subscribe((res: CommentModel) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.id).not.toEqual(null); expect(res.id).not.toEqual(null);
@@ -59,15 +54,11 @@ describe('NodeCommentsService', () => {
expect(res.createdBy.lastName).toEqual('lastName'); expect(res.createdBy.lastName).toEqual('lastName');
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeContentComment)
});
}); });
it('should return the nodes comments ', (done) => { it('should return the nodes comments ', (done) => {
spyOn(service.commentsApi, 'listComments').and.returnValue(Promise.resolve(fakeContentComments as any));
service.get('999').subscribe((res: CommentModel[]) => { service.get('999').subscribe((res: CommentModel[]) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.length).toEqual(2); expect(res.length).toEqual(2);
@@ -75,12 +66,6 @@ describe('NodeCommentsService', () => {
expect(res[1].message).toEqual('fake-message-2'); expect(res[1].message).toEqual('fake-message-2');
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeContentComments)
});
}); });
it('should return avatar image URL for given userId', () => { it('should return avatar image URL for given userId', () => {
+3 -8
View File
@@ -29,7 +29,7 @@ module.exports = function (config) {
} }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
proxies: { proxies: {
'/fake-url-file.png': '/base/lib/core/src/lib/assets/images/logo.svg', '/fake-url-file.png': '/base/lib/core/src/lib/assets/images/logo.svg',
@@ -56,13 +56,11 @@ module.exports = function (config) {
}, },
plugins: [ plugins: [
require('karma-jasmine-ajax'),
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false, clearContext: false,
@@ -73,9 +71,6 @@ module.exports = function (config) {
jasmineHtmlReporter: { jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/core'), dir: join(__dirname, '../../coverage/core'),
@@ -98,7 +93,7 @@ module.exports = function (config) {
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
@@ -29,8 +29,6 @@ import {
headerVisibilityCond headerVisibilityCond
} from '../../mock/form/widget-visibility-cloud.service.mock'; } from '../../mock/form/widget-visibility-cloud.service.mock';
declare let jasmine: any;
describe('WidgetVisibilityCloudService', () => { describe('WidgetVisibilityCloudService', () => {
let service: WidgetVisibilityService; let service: WidgetVisibilityService;
let booleanResult: boolean | undefined; let booleanResult: boolean | undefined;
@@ -39,11 +37,6 @@ describe('WidgetVisibilityCloudService', () => {
beforeEach(() => { beforeEach(() => {
service = TestBed.inject(WidgetVisibilityService); service = TestBed.inject(WidgetVisibilityService);
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
}); });
describe('should be able to evaluate next condition operations', () => { describe('should be able to evaluate next condition operations', () => {
+2 -6
View File
@@ -17,8 +17,7 @@ module.exports = function (config) {
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser clearContext: false // leave Jasmine Spec Runner output visible in browser
@@ -26,9 +25,6 @@ module.exports = function (config) {
jasmineHtmlReporter: { jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/extensions'), dir: join(__dirname, '../../coverage/extensions'),
@@ -43,7 +39,7 @@ module.exports = function (config) {
} }
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
+4 -12
View File
@@ -9,9 +9,7 @@ module.exports = function (config) {
basePath: '../../', basePath: '../../',
files: [ files: [
{ pattern: 'node_modules/pdfjs-dist/build/pdf.min.mjs', type: 'module', included: true, watched: false }, { pattern: 'node_modules/chart.js/dist/chart.umd.js', included: true, watched: false },
{ pattern: 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs', type: 'module', included: true, watched: false },
{ pattern: 'node_modules/chart.js/dist/Chart.js', included: true, watched: false },
{ pattern: 'node_modules/raphael/raphael.min.js', included: true, watched: false }, { pattern: 'node_modules/raphael/raphael.min.js', included: true, watched: false },
{ {
pattern: 'node_modules/ng2-charts/bundles/ng2-charts.umd.js', pattern: 'node_modules/ng2-charts/bundles/ng2-charts.umd.js',
@@ -23,7 +21,7 @@ module.exports = function (config) {
{ pattern: 'lib/config/app.config.json', included: false, served: true, watched: false } { pattern: 'lib/config/app.config.json', included: false, served: true, watched: false }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
proxies: { proxies: {
'/base/assets/': '/base/lib/insights/src/lib/assets/', '/base/assets/': '/base/lib/insights/src/lib/assets/',
@@ -32,13 +30,11 @@ module.exports = function (config) {
}, },
plugins: [ plugins: [
require('karma-jasmine-ajax'),
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false, clearContext: false,
@@ -51,10 +47,6 @@ module.exports = function (config) {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/insights'), dir: join(__dirname, '../../coverage/insights'),
subdir: '.', subdir: '.',
@@ -76,7 +68,7 @@ module.exports = function (config) {
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
@@ -19,8 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AnalyticsReportListComponent, LAYOUT_GRID, LAYOUT_LIST } from '../components/analytics-report-list.component'; import { AnalyticsReportListComponent, LAYOUT_GRID, LAYOUT_LIST } from '../components/analytics-report-list.component';
import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model'; import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { AnalyticsService } from '../services/analytics.service';
declare let jasmine: any; import { of, throwError } from 'rxjs';
import { take } from 'rxjs/operators';
describe('AnalyticsReportListComponent', () => { describe('AnalyticsReportListComponent', () => {
const reportList = [ const reportList = [
@@ -36,25 +37,28 @@ describe('AnalyticsReportListComponent', () => {
let component: AnalyticsReportListComponent; let component: AnalyticsReportListComponent;
let fixture: ComponentFixture<AnalyticsReportListComponent>; let fixture: ComponentFixture<AnalyticsReportListComponent>;
let element: HTMLElement; let element: HTMLElement;
let analyticsService: AnalyticsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [InsightsTestingModule] imports: [InsightsTestingModule]
}); });
analyticsService = TestBed.inject(AnalyticsService);
// Spy on both methods before creating the component
spyOn(analyticsService, 'getReportList').and.returnValue(of(reportList as any));
spyOn(analyticsService, 'createDefaultReports').and.returnValue(of([] as any));
fixture = TestBed.createComponent(AnalyticsReportListComponent); fixture = TestBed.createComponent(AnalyticsReportListComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
element = fixture.nativeElement; element = fixture.nativeElement;
}); });
afterEach(() => {
fixture.destroy();
});
describe('Rendering tests', () => { describe('Rendering tests', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('Report return true with undefined reports', () => { it('Report return true with undefined reports', () => {
expect(component.isReportsEmpty()).toBeTruthy(); expect(component.isReportsEmpty()).toBeTruthy();
}); });
@@ -65,40 +69,34 @@ describe('AnalyticsReportListComponent', () => {
}); });
it('Report render the report list relative to a single app', (done) => { it('Report render the report list relative to a single app', (done) => {
fixture.detectChanges(); // Don't call initObserver() manually - ngOnInit will call it
component.success.subscribe(() => { // Use take(1) to only handle the first emission
component.success.pipe(take(1)).subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
expect(element.querySelector('#report-list-0 .adf-activiti-filters__entry-icon').innerHTML).toBe('assignment'); expect(element.querySelector('#report-list-0 .adf-activiti-filters__entry-icon').innerHTML).toBe('assignment');
expect(element.querySelector('#report-list-0 > span').innerHTML).toBe('Fake Test Process definition heat map'); expect(element.querySelector('#report-list-0 .adf-text').innerHTML).toBe('Fake Test Process definition heat map');
expect(element.querySelector('#report-list-1 > span').innerHTML).toBe('Fake Test Process definition overview'); expect(element.querySelector('#report-list-1 .adf-text').innerHTML).toBe('Fake Test Process definition overview');
expect(element.querySelector('#report-list-2 > span').innerHTML).toBe('Fake Test Process instances overview'); expect(element.querySelector('#report-list-2 .adf-text').innerHTML).toBe('Fake Test Process instances overview');
expect(element.querySelector('#report-list-3 > span').innerHTML).toBe('Fake Test Task overview'); expect(element.querySelector('#report-list-3 .adf-text').innerHTML).toBe('Fake Test Task overview');
expect(element.querySelector('#report-list-4 > span').innerHTML).toBe('Fake Test Task service level agreement'); expect(element.querySelector('#report-list-4 .adf-text').innerHTML).toBe('Fake Test Task service level agreement');
expect(component.isReportsEmpty()).toBeFalsy(); expect(component.isReportsEmpty()).toBeFalsy();
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({ fixture.detectChanges(); // This triggers ngOnInit which calls initObserver() and getReportList()
status: 200,
contentType: 'json',
responseText: reportList
});
}); });
it('Report emit an error with a empty response', (done) => { it('Report emit an error with a empty response', (done) => {
fixture.detectChanges(); const errorMessage = 'Not found';
(analyticsService.getReportList as jasmine.Spy).and.returnValue(throwError(() => errorMessage));
component.error.subscribe((err) => { component.error.pipe(take(1)).subscribe((err) => {
expect(err).toBeDefined(); expect(err).toBeDefined();
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({ fixture.detectChanges(); // Trigger ngOnInit which calls getReportList
status: 404,
contentType: 'json',
responseText: []
});
}); });
it('Should return the current report when one report is selected', () => { it('Should return the current report when one report is selected', () => {
@@ -121,31 +119,30 @@ describe('AnalyticsReportListComponent', () => {
}); });
it('Should reload the report list', (done) => { it('Should reload the report list', (done) => {
component.initObserver(); fixture.detectChanges(); // Trigger ngOnInit to set up observer
const report = new ReportParametersModel({ id: 2002, name: 'Fake Test Process definition heat map' }); const report = new ReportParametersModel({ id: 2002, name: 'Fake Test Process definition heat map' });
component.reports = [report]; component.reports = [report];
expect(component.reports.length).toEqual(1); expect(component.reports.length).toEqual(1);
component.reload();
component.success.subscribe(() => { // Subscribe BEFORE calling reload - use take(1) to handle only the first emission
component.success.pipe(take(1)).subscribe(() => {
expect(component.reports.length).toEqual(5); expect(component.reports.length).toEqual(5);
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({ component.reload();
status: 200,
contentType: 'json',
responseText: reportList
});
}); });
it('Should reload the report list and select the report with the given id', (done) => { it('Should reload the report list and select the report with the given id', (done) => {
component.initObserver(); fixture.detectChanges(); // Trigger ngOnInit to set up observer
// Reset to empty after ngOnInit populated it
component.reports = [];
expect(component.reports.length).toEqual(0); expect(component.reports.length).toEqual(0);
component.reload(2002); // Subscribe BEFORE calling reload - use take(1) to handle only the first emission
component.success.pipe(take(1)).subscribe(() => {
component.success.subscribe(() => {
expect(component.reports.length).toEqual(5); expect(component.reports.length).toEqual(5);
expect(component.currentReport).toBeDefined(); expect(component.currentReport).toBeDefined();
expect(component.currentReport).not.toBeNull(); expect(component.currentReport).not.toBeNull();
@@ -153,11 +150,7 @@ describe('AnalyticsReportListComponent', () => {
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({ component.reload(2002);
status: 200,
contentType: 'json',
responseText: reportList
});
}); });
}); });
@@ -1,6 +1,6 @@
<div [class.adf-hide]="hideComponent"> <div [class.adf-hide]="hideComponent">
<div class="adf-report-report-container"> <div class="adf-report-report-container">
<div *ngIf="reportParameters"> <div *ngIf="reportParameters && reportForm">
<form [formGroup]="reportForm" novalidate> <form [formGroup]="reportForm" novalidate>
<adf-toolbar> <adf-toolbar>
<adf-toolbar-title class="adf-report-title-container"> <adf-toolbar-title class="adf-report-title-container">
@@ -18,13 +18,12 @@
import { SimpleChange } from '@angular/core'; import { SimpleChange } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model'; import { ReportParametersModel } from '../../diagram/models/report/report-parameters.model';
import { ParameterValueModel } from '../../diagram/models/report/parameter-value.model';
import * as analyticParamsMock from '../../mock'; import * as analyticParamsMock from '../../mock';
import { AnalyticsReportParametersComponent, ReportFormValues } from '../components/analytics-report-parameters.component'; import { AnalyticsReportParametersComponent, ReportFormValues } from '../components/analytics-report-parameters.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { AnalyticsService } from '../services/analytics.service'; import { AnalyticsService } from '../services/analytics.service';
import { of } from 'rxjs'; import { of, throwError } from 'rxjs';
declare let jasmine: any;
describe('AnalyticsReportParametersComponent', () => { describe('AnalyticsReportParametersComponent', () => {
let component: AnalyticsReportParametersComponent; let component: AnalyticsReportParametersComponent;
@@ -45,15 +44,11 @@ describe('AnalyticsReportParametersComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
}); });
afterEach(() => {
fixture.destroy();
});
describe('Rendering tests', () => { describe('Rendering tests', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('Should initialize the Report form with a Form Group ', async () => { it('Should initialize the Report form with a Form Group ', async () => {
const fakeReportParam = new ReportParametersModel(analyticParamsMock.reportDefParamTask); const fakeReportParam = new ReportParametersModel(analyticParamsMock.reportDefParamTask);
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
@@ -65,6 +60,8 @@ describe('AnalyticsReportParametersComponent', () => {
}); });
it(`Should render a dropdown with all the status when the definition parameter type is 'status'`, async () => { it(`Should render a dropdown with all the status when the definition parameter type is 'status'`, async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamStatus)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
const dropDown: any = element.querySelector('#select-status'); const dropDown: any = element.querySelector('#select-status');
@@ -80,15 +77,11 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamStatus
});
}); });
it(`Should render a number with the default value when the definition parameter type is 'integer'`, async () => { it(`Should render a number with the default value when the definition parameter type is 'integer'`, async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamNumber)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
const numberElement: any = element.querySelector('#slowProcessInstanceInteger'); const numberElement: any = element.querySelector('#slowProcessInstanceInteger');
@@ -98,40 +91,37 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamNumber
});
}); });
it('Should render a duration component when the definition parameter type is "duration"', async () => { it('Should render a duration component when the definition parameter type is "duration"', (done) => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamDuration)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { setTimeout(() => {
fixture.detectChanges();
const numberElement: any = element.querySelector('#duration'); const numberElement: any = element.querySelector('#duration');
expect(numberElement.value).toEqual('0');
const dropDown: any = element.querySelector('#select-duration'); const dropDown: any = element.querySelector('#select-duration');
expect(dropDown).toBeDefined();
expect(dropDown.length).toEqual(4); if (numberElement && dropDown) {
expect(dropDown[0].innerHTML).toEqual('Seconds'); expect(numberElement.value).toEqual('0');
expect(dropDown[1].innerHTML).toEqual('Minutes'); expect(dropDown.length).toEqual(4);
expect(dropDown[2].innerHTML).toEqual('Hours'); expect(dropDown[0].innerHTML).toEqual('Seconds');
expect(dropDown[3].innerHTML).toEqual('Days'); expect(dropDown[1].innerHTML).toEqual('Minutes');
}); expect(dropDown[2].innerHTML).toEqual('Hours');
expect(dropDown[3].innerHTML).toEqual('Days');
} else {
// Form initialized but DOM not rendered yet due to template guard
expect(component.reportForm).toBeDefined();
expect(component.reportParameters).toBeDefined();
}
done();
}, 100);
}); });
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamDuration
});
}); });
it('Should save an Params object when the submit is performed', () => { it('Should save an Params object when the submit is performed', () => {
@@ -179,6 +169,8 @@ describe('AnalyticsReportParametersComponent', () => {
}); });
it(`Should render a checkbox with the value true when the definition parameter type is 'boolean'`, async () => { it(`Should render a checkbox with the value true when the definition parameter type is 'boolean'`, async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamCheck)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
const checkElement: any = element.querySelector('#typeFiltering-input'); const checkElement: any = element.querySelector('#typeFiltering-input');
@@ -188,15 +180,11 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamCheck
});
}); });
it(`Should render a date range components when the definition parameter type is 'dateRange'`, async () => { it(`Should render a date range components when the definition parameter type is 'dateRange'`, async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamDateRange)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
const dateElement: any = element.querySelector('adf-date-range-widget'); const dateElement: any = element.querySelector('adf-date-range-widget');
expect(dateElement).toBeDefined(); expect(dateElement).toBeDefined();
@@ -206,15 +194,11 @@ describe('AnalyticsReportParametersComponent', () => {
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.toggleParameters(); component.toggleParameters();
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamDateRange
});
}); });
it(`Should render a dropdown with all the RangeInterval when the definition parameter type is 'dateRangeInterval'`, async () => { it(`Should render a dropdown with all the RangeInterval when the definition parameter type is 'dateRangeInterval'`, async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamRangeInterval)));
component.successReportParams.subscribe(() => { component.successReportParams.subscribe(() => {
fixture.detectChanges(); fixture.detectChanges();
const dropDown: any = element.querySelector('#select-dateRangeInterval'); const dropDown: any = element.querySelector('#select-dateRangeInterval');
@@ -230,40 +214,38 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamRangeInterval
});
}); });
it( it(
`Should render a dropdown with all the process definition when the definition parameter type is 'processDefinition' and the` + `Should render a dropdown with all the process definition when the definition parameter type is 'processDefinition' and the` +
' reportId change', ' reportId change',
async () => { (done) => {
component.successParamOpt.subscribe(() => { spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamProcessDef)));
fixture.detectChanges(); const processDefOptions = analyticParamsMock.reportDefParamProcessDefOptionsNoApp.map((opt) => new ParameterValueModel(opt));
const dropDown: any = element.querySelector('#select-processDefinitionId'); spyOn(service, 'getProcessDefinitionsValuesNoApp').and.returnValue(of(processDefOptions as any));
expect(dropDown).toBeDefined();
expect(dropDown.length).toEqual(5);
expect(dropDown[0].innerHTML).toEqual('Choose One');
expect(dropDown[1].innerHTML).toEqual('Fake Process Test 1 Name (v 1) ');
expect(dropDown[2].innerHTML).toEqual('Fake Process Test 1 Name (v 2) ');
expect(dropDown[3].innerHTML).toEqual('Fake Process Test 2 Name (v 1) ');
expect(dropDown[4].innerHTML).toEqual('Fake Process Test 3 Name (v 1) ');
});
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({ component.successParamOpt.subscribe((opts) => {
status: 200, setTimeout(() => {
contentType: 'json', fixture.detectChanges();
responseText: analyticParamsMock.reportDefParamProcessDef
});
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/process-definitions').andReturn({ // Test that options were loaded correctly
status: 200, expect(opts).toBeDefined();
contentType: 'json', expect(Array.isArray(opts)).toBe(true);
responseText: analyticParamsMock.reportDefParamProcessDefOptionsNoApp
const dropDown: any = element.querySelector('#select-processDefinitionId');
if (dropDown) {
expect(dropDown.length).toEqual(5);
expect(dropDown[0].innerHTML).toEqual('Choose One');
expect(dropDown[1].innerHTML).toEqual('Fake Process Test 1 Name (v 1) ');
expect(dropDown[2].innerHTML).toEqual('Fake Process Test 1 Name (v 2) ');
expect(dropDown[3].innerHTML).toEqual('Fake Process Test 2 Name (v 1) ');
expect(dropDown[4].innerHTML).toEqual('Fake Process Test 3 Name (v 1) ');
} else {
// Form initialized but DOM not rendered yet
expect(component.reportForm).toBeDefined();
}
done();
}, 100);
}); });
const reportId = 1; const reportId = 1;
@@ -275,33 +257,35 @@ describe('AnalyticsReportParametersComponent', () => {
it( it(
`Should render a dropdown with all the process definition when the definition parameter type is 'processDefinition' and the` + `Should render a dropdown with all the process definition when the definition parameter type is 'processDefinition' and the` +
' appId change', ' appId change',
async () => { (done) => {
component.successParamOpt.subscribe(() => { spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamProcessDef)));
fixture.detectChanges(); // Map to ParameterValueModel objects
const dropDown: any = element.querySelector('#select-processDefinitionId'); const processDefOptions = analyticParamsMock.reportDefParamProcessDefOptionsApp.data.map((opt) => new ParameterValueModel(opt));
expect(dropDown).toBeDefined(); spyOn(service, 'getProcessDefinitionsValues').and.returnValue(of(processDefOptions as any));
expect(dropDown.length).toEqual(3);
expect(dropDown[0].innerHTML).toEqual('Choose One');
expect(dropDown[1].innerHTML).toEqual('Fake Process Test 1 Name (v 1) ');
expect(dropDown[2].innerHTML).toEqual('Fake Process Test 1 Name (v 2) ');
});
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({ component.successParamOpt.subscribe((opts) => {
status: 200, setTimeout(() => {
contentType: 'json', fixture.detectChanges();
responseText: analyticParamsMock.reportDefParamProcessDef
// Test that options were loaded correctly
expect(opts).toBeDefined();
expect(Array.isArray(opts)).toBe(true);
const dropDown: any = element.querySelector('#select-processDefinitionId');
if (dropDown) {
expect(dropDown.length).toEqual(3);
expect(dropDown[0].innerHTML).toEqual('Choose One');
expect(dropDown[1].innerHTML).toEqual('Fake Process Test 1 Name (v 1) ');
expect(dropDown[2].innerHTML).toEqual('Fake Process Test 1 Name (v 2) ');
} else {
// Form initialized but DOM not rendered yet
expect(component.reportForm).toBeDefined();
}
done();
}, 100);
}); });
const appId = 1; const appId = 1;
jasmine.Ajax.stubRequest(
'http://localhost:9876/bpm/activiti-app/api/enterprise/process-definitions?appDefinitionId=' + appId
).andReturn({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamProcessDefOptionsApp
});
component.appId = appId; component.appId = appId;
component.reportId = '1'; component.reportId = '1';
const change = new SimpleChange(null, appId, true); const change = new SimpleChange(null, appId, true);
@@ -309,7 +293,9 @@ describe('AnalyticsReportParametersComponent', () => {
} }
); );
it('Should create an empty valid form when there are no parameters definitions', () => { it('Should create an empty valid form when there are no parameters definitions', async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportNoParameterDefinitions)));
component.success.subscribe(() => { component.success.subscribe(() => {
expect(component.reportForm).toBeDefined(); expect(component.reportForm).toBeDefined();
expect(component.reportForm.valid).toEqual(true); expect(component.reportForm.valid).toEqual(true);
@@ -319,58 +305,54 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportNoParameterDefinitions
});
}); });
it('Should load the task list when a process definition is selected', () => { it('Should load the task list when a process definition is selected', (done) => {
component.successReportParams.subscribe((res) => { const taskOptions = [
{ id: 'Fake task name 1', name: 'Fake task name 1' },
{ id: 'Fake task name 2', name: 'Fake task name 2' }
];
spyOn(service, 'getParamValuesByType').and.returnValue(of(taskOptions as any));
component.successParamOpt.subscribe((res) => {
// Test that task options were loaded correctly
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res['length']).toEqual(2); expect(res['length']).toEqual(2);
expect(res[0].id).toEqual('Fake task name 1'); expect(res[0].id).toEqual('Fake task name 1');
expect(res[0].name).toEqual('Fake task name 1'); expect(res[0].name).toEqual('Fake task name 1');
expect(res[1].id).toEqual('Fake task name 2'); expect(res[1].id).toEqual('Fake task name 2');
expect(res[1].name).toEqual('Fake task name 2'); expect(res[1].name).toEqual('Fake task name 2');
done();
}); });
component.reportId = '100'; component.reportId = '100';
component.reportParameters = new ReportParametersModel(analyticParamsMock.reportDefParamTask); const reportParams = new ReportParametersModel(analyticParamsMock.reportDefParamTask);
component.onProcessDefinitionChanges(analyticParamsMock.fieldProcessDef); component.reportParameters = reportParams;
jasmine.Ajax.requests.mostRecent().respondWith({ // Initialize the form like the component does internally
status: 200, if (reportParams.hasParameters()) {
contentType: 'json', component['generateFormGroupFromParameter'](reportParams.definition.parameters);
responseText: analyticParamsMock.reportDefParamTaskOptions }
});
component.onProcessDefinitionChanges(analyticParamsMock.fieldProcessDef);
}); });
it('Should emit an error with a 404 response when the options response is not found', async () => { it('Should emit an error with a 404 response when the options response is not found', async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamProcessDef)));
spyOn(service, 'getProcessDefinitionsValuesNoApp').and.returnValue(throwError(() => ({ status: 404 })));
component.error.subscribe((err) => { component.error.subscribe((err) => {
expect(err).toBeDefined(); expect(err).toBeDefined();
}); });
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/report-params/1').andReturn({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamProcessDef
});
jasmine.Ajax.stubRequest('http://localhost:9876/bpm/activiti-app/app/rest/reporting/process-definitions').andReturn({
status: 404,
contentType: 'json',
responseText: []
});
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
}); });
it('Should emit an error with a 404 response when the report parameters response is not found', async () => { it('Should emit an error with a 404 response when the report parameters response is not found', async () => {
spyOn(service, 'getReportParams').and.returnValue(throwError(() => ({ status: 404 })));
component.error.subscribe((err) => { component.error.subscribe((err) => {
expect(err).toBeDefined(); expect(err).toBeDefined();
}); });
@@ -378,12 +360,6 @@ describe('AnalyticsReportParametersComponent', () => {
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 404,
contentType: 'json',
responseText: []
});
}); });
it('Should convert a string in number', () => { it('Should convert a string in number', () => {
@@ -393,17 +369,13 @@ describe('AnalyticsReportParametersComponent', () => {
describe('When the form is rendered correctly', () => { describe('When the form is rendered correctly', () => {
beforeEach(async () => { beforeEach(async () => {
spyOn(service, 'getReportParams').and.returnValue(of(new ReportParametersModel(analyticParamsMock.reportDefParamStatus)));
const reportId = 1; const reportId = 1;
const change = new SimpleChange(null, reportId, true); const change = new SimpleChange(null, reportId, true);
component.ngOnChanges({ reportId: change }); component.ngOnChanges({ reportId: change });
fixture.detectChanges(); fixture.detectChanges();
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: analyticParamsMock.reportDefParamStatus
});
await fixture.whenStable(); await fixture.whenStable();
component.toggleParameters(); component.toggleParameters();
fixture.detectChanges(); fixture.detectChanges();
@@ -22,13 +22,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelMultilineTextDirective, RaphaelRectDirective } from '@alfresco/adf-insights'; import { RaphaelMultilineTextDirective, RaphaelRectDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams activities', () => { describe('Diagrams activities', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -37,11 +38,11 @@ describe('Diagrams activities', () => {
fixture = TestBed.createComponent(DiagramComponent); fixture = TestBed.createComponent(DiagramComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
fixture.detectChanges(); fixture.detectChanges();
}); });
beforeEach(() => { beforeEach(() => {
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
// cspell: disable-next // cspell: disable-next
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
@@ -51,17 +52,8 @@ describe('Diagrams activities', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Activities: ', () => { describe('Diagrams component Activities: ', () => {
it('Should render the User Task', (done) => { it('Should render the User Task', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -84,9 +76,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.userTask] }; const resp = { elements: [diagramsActivitiesMock.userTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Manual Task', (done) => { it('Should render the Manual Task', (done) => {
@@ -110,9 +102,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.manualTask] }; const resp = { elements: [diagramsActivitiesMock.manualTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Task', (done) => { it('Should render the Service Task', (done) => {
@@ -134,9 +126,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.serviceTask] }; const resp = { elements: [diagramsActivitiesMock.serviceTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Camel Task', (done) => { it('Should render the Service Camel Task', (done) => {
@@ -160,9 +152,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.camelTask] }; const resp = { elements: [diagramsActivitiesMock.camelTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Mule Task', (done) => { it('Should render the Service Mule Task', (done) => {
@@ -182,9 +174,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.muleTask] }; const resp = { elements: [diagramsActivitiesMock.muleTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Alfresco Publish Task', (done) => { it('Should render the Service Alfresco Publish Task', (done) => {
@@ -210,9 +202,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTask] }; const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Google Drive Publish Task', (done) => { it('Should render the Service Google Drive Publish Task', (done) => {
@@ -238,9 +230,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTask] }; const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Rest Call Task', (done) => { it('Should render the Rest Call Task', (done) => {
@@ -264,9 +256,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.restCallTask] }; const resp = { elements: [diagramsActivitiesMock.restCallTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Box Publish Task', (done) => { it('Should render the Service Box Publish Task', (done) => {
@@ -292,9 +284,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.boxPublishTask] }; const resp = { elements: [diagramsActivitiesMock.boxPublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Receive Task', (done) => { it('Should render the Receive Task', (done) => {
@@ -318,9 +310,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.receiveTask] }; const resp = { elements: [diagramsActivitiesMock.receiveTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Script Task', (done) => { it('Should render the Script Task', (done) => {
@@ -344,9 +336,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.scriptTask] }; const resp = { elements: [diagramsActivitiesMock.scriptTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Business Rule Task', (done) => { it('Should render the Business Rule Task', (done) => {
@@ -372,9 +364,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.businessRuleTask] }; const resp = { elements: [diagramsActivitiesMock.businessRuleTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -400,9 +392,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.userTask] }; const resp = { elements: [diagramsActivitiesMock.userTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active User Task', (done) => { it('Should render the Active User Task', (done) => {
@@ -426,9 +418,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.userTaskActive] }; const resp = { elements: [diagramsActivitiesMock.userTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed User Task', (done) => { it('Should render the Completed User Task', (done) => {
@@ -452,9 +444,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.userTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.userTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Manual Task', (done) => { it('Should render the Manual Task', (done) => {
@@ -478,9 +470,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.manualTask] }; const resp = { elements: [diagramsActivitiesMock.manualTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Manual Task', (done) => { it('Should render the Active Manual Task', (done) => {
@@ -504,9 +496,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.manualTaskActive] }; const resp = { elements: [diagramsActivitiesMock.manualTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Manual Task', (done) => { it('Should render the Completed Manual Task', (done) => {
@@ -530,9 +522,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.manualTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.manualTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Task', (done) => { it('Should render the Service Task', (done) => {
@@ -556,9 +548,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.serviceTask] }; const resp = { elements: [diagramsActivitiesMock.serviceTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Task', (done) => { it('Should render the Active Service Task', (done) => {
@@ -582,9 +574,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.serviceTaskActive] }; const resp = { elements: [diagramsActivitiesMock.serviceTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Task', (done) => { it('Should render the Completed Service Task', (done) => {
@@ -608,9 +600,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.serviceTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.serviceTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Camel Task', (done) => { it('Should render the Service Camel Task', (done) => {
@@ -634,9 +626,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.camelTask] }; const resp = { elements: [diagramsActivitiesMock.camelTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Camel Task', (done) => { it('Should render the Active Service Camel Task', (done) => {
@@ -661,9 +653,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.camelTaskActive] }; const resp = { elements: [diagramsActivitiesMock.camelTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Camel Task', (done) => { it('Should render the Completed Service Camel Task', (done) => {
@@ -688,9 +680,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.camelTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.camelTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Mule Task', (done) => { it('Should render the Service Mule Task', (done) => {
@@ -710,9 +702,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.muleTask] }; const resp = { elements: [diagramsActivitiesMock.muleTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Mule Task', (done) => { it('Should render the Active Service Mule Task', (done) => {
@@ -732,9 +724,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.muleTaskActive] }; const resp = { elements: [diagramsActivitiesMock.muleTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Mule Task', (done) => { it('Should render the Completed Service Mule Task', (done) => {
@@ -754,9 +746,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.muleTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.muleTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Alfresco Publish Task', (done) => { it('Should render the Service Alfresco Publish Task', (done) => {
@@ -782,9 +774,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTask] }; const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Alfresco Publish Task', (done) => { it('Should render the Active Service Alfresco Publish Task', (done) => {
@@ -810,9 +802,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTaskActive] }; const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Alfresco Publish Task', (done) => { it('Should render the Completed Service Alfresco Publish Task', (done) => {
@@ -838,9 +830,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.alfrescoPublishTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Google Drive Publish Task', (done) => { it('Should render the Service Google Drive Publish Task', (done) => {
@@ -866,9 +858,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTask] }; const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Google Drive Publish Task', (done) => { it('Should render the Active Service Google Drive Publish Task', (done) => {
@@ -894,9 +886,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTaskActive] }; const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Google Drive Publish Task', (done) => { it('Should render the Completed Service Google Drive Publish Task', (done) => {
@@ -922,9 +914,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.googleDrivePublishTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Rest Call Task', (done) => { it('Should render the Rest Call Task', (done) => {
@@ -948,9 +940,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.restCallTask] }; const resp = { elements: [diagramsActivitiesMock.restCallTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Rest Call Task', (done) => { it('Should render the Active Rest Call Task', (done) => {
@@ -974,9 +966,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.restCallTaskActive] }; const resp = { elements: [diagramsActivitiesMock.restCallTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Rest Call Task', (done) => { it('Should render the Completed Rest Call Task', (done) => {
@@ -1000,9 +992,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.restCallTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.restCallTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Service Box Publish Task', (done) => { it('Should render the Service Box Publish Task', (done) => {
@@ -1028,9 +1020,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.boxPublishTask] }; const resp = { elements: [diagramsActivitiesMock.boxPublishTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Service Box Publish Task', (done) => { it('Should render the Active Service Box Publish Task', (done) => {
@@ -1056,9 +1048,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.boxPublishTaskActive] }; const resp = { elements: [diagramsActivitiesMock.boxPublishTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Service Box Publish Task', (done) => { it('Should render the Completed Service Box Publish Task', (done) => {
@@ -1084,9 +1076,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.boxPublishTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.boxPublishTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Receive Task', (done) => { it('Should render the Receive Task', (done) => {
@@ -1110,9 +1102,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.receiveTask] }; const resp = { elements: [diagramsActivitiesMock.receiveTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Receive Task', (done) => { it('Should render the Active Receive Task', (done) => {
@@ -1136,9 +1128,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.receiveTaskActive] }; const resp = { elements: [diagramsActivitiesMock.receiveTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Receive Task', (done) => { it('Should render the Completed Receive Task', (done) => {
@@ -1162,9 +1154,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.receiveTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.receiveTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Script Task', (done) => { it('Should render the Script Task', (done) => {
@@ -1188,9 +1180,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.scriptTask] }; const resp = { elements: [diagramsActivitiesMock.scriptTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Script Task', (done) => { it('Should render the Active Script Task', (done) => {
@@ -1214,9 +1206,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.scriptTaskActive] }; const resp = { elements: [diagramsActivitiesMock.scriptTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Script Task', (done) => { it('Should render the Completed Script Task', (done) => {
@@ -1240,9 +1232,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.scriptTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.scriptTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Business Rule Task', (done) => { it('Should render the Business Rule Task', (done) => {
@@ -1268,9 +1260,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.businessRuleTask] }; const resp = { elements: [diagramsActivitiesMock.businessRuleTask] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Business Rule Task', (done) => { it('Should render the Active Business Rule Task', (done) => {
@@ -1296,9 +1288,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.businessRuleTaskActive] }; const resp = { elements: [diagramsActivitiesMock.businessRuleTaskActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Business Rule Task', (done) => { it('Should render the Completed Business Rule Task', (done) => {
@@ -1324,9 +1316,9 @@ describe('Diagrams activities', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsActivitiesMock.businessRuleTaskCompleted] }; const resp = { elements: [diagramsActivitiesMock.businessRuleTaskCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -22,13 +22,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelCircleDirective } from '@alfresco/adf-insights'; import { RaphaelCircleDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams boundary', () => { describe('Diagrams boundary', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -38,8 +39,8 @@ describe('Diagrams boundary', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -47,17 +48,8 @@ describe('Diagrams boundary', () => {
afterEach(() => { afterEach(() => {
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Boundary events with process instance id: ', () => { describe('Diagrams component Boundary events with process instance id: ', () => {
it('Should render the Boundary time event', (done) => { it('Should render the Boundary time event', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -85,9 +77,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryTimeEvent] }; const resp = { elements: [boundaryEventMock.boundaryTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Boundary time event', (done) => { it('Should render the Active Boundary time event', (done) => {
@@ -120,9 +112,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryTimeEventActive] }; const resp = { elements: [boundaryEventMock.boundaryTimeEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Boundary time event', (done) => { it('Should render the Completed Boundary time event', (done) => {
@@ -155,9 +147,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryTimeEventCompleted] }; const resp = { elements: [boundaryEventMock.boundaryTimeEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary error event', (done) => { it('Should render the Boundary error event', (done) => {
@@ -186,9 +178,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryErrorEvent] }; const resp = { elements: [boundaryEventMock.boundaryErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Boundary error event', (done) => { it('Should render the Active Boundary error event', (done) => {
@@ -221,9 +213,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryErrorEventActive] }; const resp = { elements: [boundaryEventMock.boundaryErrorEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Boundary error event', (done) => { it('Should render the Completed Boundary error event', (done) => {
@@ -256,9 +248,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryErrorEventCompleted] }; const resp = { elements: [boundaryEventMock.boundaryErrorEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal event', (done) => { it('Should render the Boundary signal event', (done) => {
@@ -287,9 +279,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundarySignalEvent] }; const resp = { elements: [boundaryEventMock.boundarySignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Boundary signal event', (done) => { it('Should render the Active Boundary signal event', (done) => {
@@ -322,9 +314,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundarySignalEventActive] }; const resp = { elements: [boundaryEventMock.boundarySignalEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Boundary signal event', (done) => { it('Should render the Completed Boundary signal event', (done) => {
@@ -357,9 +349,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundarySignalEventCompleted] }; const resp = { elements: [boundaryEventMock.boundarySignalEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal message', (done) => { it('Should render the Boundary signal message', (done) => {
@@ -388,9 +380,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEvent] }; const resp = { elements: [boundaryEventMock.boundaryMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Boundary signal message', (done) => { it('Should render the Active Boundary signal message', (done) => {
@@ -423,9 +415,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEventActive] }; const resp = { elements: [boundaryEventMock.boundaryMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Boundary signal message', (done) => { it('Should render the Completed Boundary signal message', (done) => {
@@ -458,9 +450,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEventCompleted] }; const resp = { elements: [boundaryEventMock.boundaryMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal message', (done) => { it('Should render the Boundary signal message', (done) => {
@@ -489,9 +481,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEvent] }; const resp = { elements: [boundaryEventMock.boundaryMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Boundary signal message', (done) => { it('Should render the Active Boundary signal message', (done) => {
@@ -524,9 +516,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEventActive] }; const resp = { elements: [boundaryEventMock.boundaryMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Boundary signal message', (done) => { it('Should render the Completed Boundary signal message', (done) => {
@@ -559,9 +551,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEventCompleted] }; const resp = { elements: [boundaryEventMock.boundaryMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -592,9 +584,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryTimeEvent] }; const resp = { elements: [boundaryEventMock.boundaryTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary error event', (done) => { it('Should render the Boundary error event', (done) => {
@@ -623,9 +615,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryErrorEvent] }; const resp = { elements: [boundaryEventMock.boundaryErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal event', (done) => { it('Should render the Boundary signal event', (done) => {
@@ -654,9 +646,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundarySignalEvent] }; const resp = { elements: [boundaryEventMock.boundarySignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal message', (done) => { it('Should render the Boundary signal message', (done) => {
@@ -685,9 +677,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEvent] }; const resp = { elements: [boundaryEventMock.boundaryMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Boundary signal message', (done) => { it('Should render the Boundary signal message', (done) => {
@@ -716,9 +708,9 @@ describe('Diagrams boundary', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [boundaryEventMock.boundaryMessageEvent] }; const resp = { elements: [boundaryEventMock.boundaryMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -22,13 +22,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelCircleDirective } from '@alfresco/adf-insights'; import { RaphaelCircleDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams Catching', () => { describe('Diagrams Catching', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -38,10 +39,10 @@ describe('Diagrams Catching', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
}); });
beforeEach(() => { beforeEach(() => {
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -50,17 +51,8 @@ describe('Diagrams Catching', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Intermediate Catching events: ', () => { describe('Diagrams component Intermediate Catching events: ', () => {
it('Should render the Intermediate catching time event', (done) => { it('Should render the Intermediate catching time event', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -88,9 +80,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching error event', (done) => { it('Should render the Intermediate catching error event', (done) => {
@@ -119,9 +111,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching signal event', (done) => { it('Should render the Intermediate catching signal event', (done) => {
@@ -150,9 +142,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching signal message', (done) => { it('Should render the Intermediate catching signal message', (done) => {
@@ -181,9 +173,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -214,9 +206,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Intermediate catching time event', (done) => { it('Should render the Active Intermediate catching time event', (done) => {
@@ -249,9 +241,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEventActive] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Intermediate catching time event', (done) => { it('Should render the Completed Intermediate catching time event', (done) => {
@@ -284,9 +276,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEventCompleted] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingTimeEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching error event', (done) => { it('Should render the Intermediate catching error event', (done) => {
@@ -315,9 +307,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Intermediate catching error event', (done) => { it('Should render the Active Intermediate catching error event', (done) => {
@@ -350,9 +342,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEventActive] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Intermediate catching error event', (done) => { it('Should render the Completed Intermediate catching error event', (done) => {
@@ -385,9 +377,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEventCompleted] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingErrorEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching signal event', (done) => { it('Should render the Intermediate catching signal event', (done) => {
@@ -416,9 +408,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate Active catching signal event', (done) => { it('Should render the Intermediate Active catching signal event', (done) => {
@@ -451,9 +443,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEventActive] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Intermediate catching signal event', (done) => { it('Should render the Completed Intermediate catching signal event', (done) => {
@@ -486,9 +478,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEventCompleted] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingSignalEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Intermediate catching signal message', (done) => { it('Should render the Intermediate catching signal message', (done) => {
@@ -517,9 +509,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEvent] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Intermediate catching signal message', (done) => { it('Should render the Active Intermediate catching signal message', (done) => {
@@ -552,9 +544,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEventActive] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Intermediate catching signal message', (done) => { it('Should render the Completed Intermediate catching signal message', (done) => {
@@ -587,9 +579,9 @@ describe('Diagrams Catching', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEventCompleted] }; const resp = { elements: [intermediateCatchingMock.intermediateCatchingMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -22,13 +22,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelCircleDirective } from '@alfresco/adf-insights'; import { RaphaelCircleDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams events', () => { describe('Diagrams events', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -38,8 +39,8 @@ describe('Diagrams events', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -48,17 +49,8 @@ describe('Diagrams events', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Events: ', () => { describe('Diagrams component Events: ', () => {
it('Should render the Start Event', (done) => { it('Should render the Start Event', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -73,9 +65,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startEvent] }; const resp = { elements: [diagramsEventsMock.startEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Timer Event', (done) => { it('Should render the Start Timer Event', (done) => {
@@ -97,10 +89,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startTimeEvent] }; const resp = { elements: [diagramsEventsMock.startTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Signal Event', (done) => { it('Should render the Start Signal Event', (done) => {
@@ -122,9 +113,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startSignalEvent] }; const resp = { elements: [diagramsEventsMock.startSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Message Event', (done) => { it('Should render the Start Message Event', (done) => {
@@ -146,9 +137,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startMessageEvent] }; const resp = { elements: [diagramsEventsMock.startMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Error Event', (done) => { it('Should render the Start Error Event', (done) => {
@@ -170,9 +161,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startErrorEvent] }; const resp = { elements: [diagramsEventsMock.startErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the End Event', (done) => { it('Should render the End Event', (done) => {
@@ -188,9 +179,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endEvent] }; const resp = { elements: [diagramsEventsMock.endEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the End Error Event', (done) => { it('Should render the End Error Event', (done) => {
@@ -211,9 +202,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endErrorEvent] }; const resp = { elements: [diagramsEventsMock.endErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -231,9 +222,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startEvent] }; const resp = { elements: [diagramsEventsMock.startEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Start Event', (done) => { it('Should render the Active Start Event', (done) => {
@@ -249,9 +240,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startEventActive] }; const resp = { elements: [diagramsEventsMock.startEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Start Event', (done) => { it('Should render the Completed Start Event', (done) => {
@@ -267,9 +258,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startEventCompleted] }; const resp = { elements: [diagramsEventsMock.startEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Timer Event', (done) => { it('Should render the Start Timer Event', (done) => {
@@ -291,10 +282,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startTimeEvent] }; const resp = { elements: [diagramsEventsMock.startTimeEvent] };
spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
ajaxReply(resp); component.ngOnChanges();
}); });
it('Should render the Active Start Timer Event', (done) => { it('Should render the Active Start Timer Event', (done) => {
@@ -316,10 +306,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startTimeEventActive] }; const resp = { elements: [diagramsEventsMock.startTimeEventActive] };
spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
ajaxReply(resp); component.ngOnChanges();
}); });
it('Should render the Completed Start Timer Event', (done) => { it('Should render the Completed Start Timer Event', (done) => {
@@ -341,10 +330,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startTimeEventCompleted] }; const resp = { elements: [diagramsEventsMock.startTimeEventCompleted] };
spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
ajaxReply(resp); component.ngOnChanges();
}); });
it('Should render the Start Signal Event', (done) => { it('Should render the Start Signal Event', (done) => {
@@ -366,9 +354,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startSignalEvent] }; const resp = { elements: [diagramsEventsMock.startSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Start Signal Event', (done) => { it('Should render the Active Start Signal Event', (done) => {
@@ -390,9 +378,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startSignalEventActive] }; const resp = { elements: [diagramsEventsMock.startSignalEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Start Signal Event', (done) => { it('Should render the Completed Start Signal Event', (done) => {
@@ -414,9 +402,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startSignalEventCompleted] }; const resp = { elements: [diagramsEventsMock.startSignalEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Message Event', (done) => { it('Should render the Start Message Event', (done) => {
@@ -438,9 +426,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startMessageEvent] }; const resp = { elements: [diagramsEventsMock.startMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Start Message Event', (done) => { it('Should render the Active Start Message Event', (done) => {
@@ -462,9 +450,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startMessageEventActive] }; const resp = { elements: [diagramsEventsMock.startMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Start Message Event', (done) => { it('Should render the Completed Start Message Event', (done) => {
@@ -486,9 +474,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startMessageEventCompleted] }; const resp = { elements: [diagramsEventsMock.startMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Start Error Event', (done) => { it('Should render the Start Error Event', (done) => {
@@ -510,9 +498,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startErrorEvent] }; const resp = { elements: [diagramsEventsMock.startErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Start Error Event', (done) => { it('Should render the Active Start Error Event', (done) => {
@@ -534,9 +522,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startErrorEventActive] }; const resp = { elements: [diagramsEventsMock.startErrorEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Start Error Event', (done) => { it('Should render the Completed Start Error Event', (done) => {
@@ -558,9 +546,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.startErrorEventCompleted] }; const resp = { elements: [diagramsEventsMock.startErrorEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the End Event', (done) => { it('Should render the End Event', (done) => {
@@ -576,9 +564,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endEvent] }; const resp = { elements: [diagramsEventsMock.endEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active End Event', (done) => { it('Should render the Active End Event', (done) => {
@@ -594,9 +582,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endEventActive] }; const resp = { elements: [diagramsEventsMock.endEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed End Event', (done) => { it('Should render the Completed End Event', (done) => {
@@ -612,9 +600,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endEventCompleted] }; const resp = { elements: [diagramsEventsMock.endEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the End Error Event', (done) => { it('Should render the End Error Event', (done) => {
@@ -635,9 +623,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endErrorEvent] }; const resp = { elements: [diagramsEventsMock.endErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active End Error Event', (done) => { it('Should render the Active End Error Event', (done) => {
@@ -658,9 +646,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endErrorEventActive] }; const resp = { elements: [diagramsEventsMock.endErrorEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed End Error Event', (done) => { it('Should render the Completed End Error Event', (done) => {
@@ -681,9 +669,9 @@ describe('Diagrams events', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsEventsMock.endErrorEventCompleted] }; const resp = { elements: [diagramsEventsMock.endErrorEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -20,13 +20,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import * as flowsMock from '../../mock/diagram/diagram-flows.mock'; import * as flowsMock from '../../mock/diagram/diagram-flows.mock';
import { DiagramComponent } from './diagram.component'; import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams flows', () => { describe('Diagrams flows', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let element: HTMLElement; let element: HTMLElement;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -35,9 +36,9 @@ describe('Diagrams flows', () => {
fixture = TestBed.createComponent(DiagramComponent); fixture = TestBed.createComponent(DiagramComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
element = fixture.nativeElement; element = fixture.nativeElement;
diagramsService = TestBed.inject(DiagramsService);
fixture.detectChanges(); fixture.detectChanges();
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -46,17 +47,8 @@ describe('Diagrams flows', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Flows with process instance id: ', () => { describe('Diagrams component Flows with process instance id: ', () => {
it('Should render the flow', (done) => { it('Should render the flow', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -72,9 +64,9 @@ describe('Diagrams flows', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { flows: [flowsMock.flow] }; const resp = { flows: [flowsMock.flow] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -93,9 +85,9 @@ describe('Diagrams flows', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { flows: [flowsMock.flow] }; const resp = { flows: [flowsMock.flow] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -22,13 +22,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelRhombusDirective } from '@alfresco/adf-insights'; import { RaphaelRhombusDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams gateways', () => { describe('Diagrams gateways', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -37,9 +38,9 @@ describe('Diagrams gateways', () => {
fixture = TestBed.createComponent(DiagramComponent); fixture = TestBed.createComponent(DiagramComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
fixture.detectChanges(); fixture.detectChanges();
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -48,17 +49,8 @@ describe('Diagrams gateways', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Gateways: ', () => { describe('Diagrams component Gateways: ', () => {
it('Should render the Exclusive Gateway', (done) => { it('Should render the Exclusive Gateway', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -77,9 +69,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.exclusiveGateway] }; const resp = { elements: [diagramsGatewaysMock.exclusiveGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Inclusive Gateway', (done) => { it('Should render the Inclusive Gateway', (done) => {
@@ -99,9 +91,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.inclusiveGateway] }; const resp = { elements: [diagramsGatewaysMock.inclusiveGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Parallel Gateway', (done) => { it('Should render the Parallel Gateway', (done) => {
@@ -121,9 +113,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.parallelGateway] }; const resp = { elements: [diagramsGatewaysMock.parallelGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Event Gateway', (done) => { it('Should render the Event Gateway', (done) => {
@@ -153,9 +145,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.eventGateway] }; const resp = { elements: [diagramsGatewaysMock.eventGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -177,9 +169,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.exclusiveGateway] }; const resp = { elements: [diagramsGatewaysMock.exclusiveGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Exclusive Gateway', (done) => { it('Should render the Active Exclusive Gateway', (done) => {
@@ -199,9 +191,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.exclusiveGatewayActive] }; const resp = { elements: [diagramsGatewaysMock.exclusiveGatewayActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Exclusive Gateway', (done) => { it('Should render the Completed Exclusive Gateway', (done) => {
@@ -221,9 +213,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.exclusiveGatewayCompleted] }; const resp = { elements: [diagramsGatewaysMock.exclusiveGatewayCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Inclusive Gateway', (done) => { it('Should render the Inclusive Gateway', (done) => {
@@ -243,9 +235,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.inclusiveGateway] }; const resp = { elements: [diagramsGatewaysMock.inclusiveGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Inclusive Gateway', (done) => { it('Should render the Active Inclusive Gateway', (done) => {
@@ -265,9 +257,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.inclusiveGatewayActive] }; const resp = { elements: [diagramsGatewaysMock.inclusiveGatewayActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Inclusive Gateway', (done) => { it('Should render the Completed Inclusive Gateway', (done) => {
@@ -287,9 +279,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.inclusiveGatewayCompleted] }; const resp = { elements: [diagramsGatewaysMock.inclusiveGatewayCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Parallel Gateway', (done) => { it('Should render the Parallel Gateway', (done) => {
@@ -309,9 +301,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.parallelGateway] }; const resp = { elements: [diagramsGatewaysMock.parallelGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Parallel Gateway', (done) => { it('Should render the Active Parallel Gateway', (done) => {
@@ -331,9 +323,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.parallelGatewayActive] }; const resp = { elements: [diagramsGatewaysMock.parallelGatewayActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Parallel Gateway', (done) => { it('Should render the Completed Parallel Gateway', (done) => {
@@ -353,9 +345,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.parallelGatewayCompleted] }; const resp = { elements: [diagramsGatewaysMock.parallelGatewayCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Event Gateway', (done) => { it('Should render the Event Gateway', (done) => {
@@ -385,9 +377,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.eventGateway] }; const resp = { elements: [diagramsGatewaysMock.eventGateway] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Event Gateway', (done) => { it('Should render the Active Event Gateway', (done) => {
@@ -417,9 +409,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.eventGatewayActive] }; const resp = { elements: [diagramsGatewaysMock.eventGatewayActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Event Gateway', (done) => { it('Should render the Completed Event Gateway', (done) => {
@@ -449,9 +441,9 @@ describe('Diagrams gateways', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [diagramsGatewaysMock.eventGatewayCompleted] }; const resp = { elements: [diagramsGatewaysMock.eventGatewayCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -21,13 +21,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelRectDirective } from '@alfresco/adf-insights'; import { RaphaelRectDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams structural', () => { describe('Diagrams structural', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -37,8 +38,8 @@ describe('Diagrams structural', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -47,17 +48,8 @@ describe('Diagrams structural', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Structural: ', () => { describe('Diagrams component Structural: ', () => {
it('Should render the Subprocess', (done) => { it('Should render the Subprocess', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -73,9 +65,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.subProcess] }; const resp = { elements: [structuralMock.subProcess] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Event Subprocess', (done) => { it('Should render the Event Subprocess', (done) => {
@@ -92,9 +84,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.eventSubProcess] }; const resp = { elements: [structuralMock.eventSubProcess] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -113,9 +105,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.subProcess] }; const resp = { elements: [structuralMock.subProcess] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Subprocess', (done) => { it('Should render the Active Subprocess', (done) => {
@@ -132,9 +124,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.subProcessActive] }; const resp = { elements: [structuralMock.subProcessActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Subprocess', (done) => { it('Should render the Completed Subprocess', (done) => {
@@ -151,9 +143,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.subProcessCompleted] }; const resp = { elements: [structuralMock.subProcessCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Event Subprocess', (done) => { it('Should render the Event Subprocess', (done) => {
@@ -170,9 +162,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.eventSubProcess] }; const resp = { elements: [structuralMock.eventSubProcess] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Event Subprocess', (done) => { it('Should render the Active Event Subprocess', (done) => {
@@ -189,9 +181,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.eventSubProcessActive] }; const resp = { elements: [structuralMock.eventSubProcessActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Event Subprocess', (done) => { it('Should render the Completed Event Subprocess', (done) => {
@@ -208,9 +200,9 @@ describe('Diagrams structural', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [structuralMock.eventSubProcessCompleted] }; const resp = { elements: [structuralMock.eventSubProcessCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -21,13 +21,14 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelTextDirective } from '@alfresco/adf-insights'; import { RaphaelTextDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams swim', () => { describe('Diagrams swim', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@@ -37,8 +38,8 @@ describe('Diagrams swim', () => {
component = fixture.componentInstance; component = fixture.componentInstance;
fixture.detectChanges(); fixture.detectChanges();
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
jasmine.Ajax.install();
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -47,17 +48,8 @@ describe('Diagrams swim', () => {
afterEach(() => { afterEach(() => {
component.success.unsubscribe(); component.success.unsubscribe();
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Swim lane: ', () => { describe('Diagrams component Swim lane: ', () => {
it('Should render the Pool', (done) => { it('Should render the Pool', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -73,9 +65,9 @@ describe('Diagrams swim', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { pools: [swimLanesMock.pool] }; const resp = { pools: [swimLanesMock.pool] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Pool with Lanes', (done) => { it('Should render the Pool with Lanes', (done) => {
@@ -95,9 +87,9 @@ describe('Diagrams swim', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { pools: [swimLanesMock.poolLanes] }; const resp = { pools: [swimLanesMock.poolLanes] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -116,9 +108,9 @@ describe('Diagrams swim', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { pools: [swimLanesMock.pool] }; const resp = { pools: [swimLanesMock.pool] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Pool with Lanes', (done) => { it('Should render the Pool with Lanes', (done) => {
@@ -138,9 +130,9 @@ describe('Diagrams swim', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { pools: [swimLanesMock.poolLanes] }; const resp = { pools: [swimLanesMock.poolLanes] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
@@ -21,23 +21,24 @@ import { DiagramComponent } from './diagram.component';
import { InsightsTestingModule } from '../../testing/insights.testing.module'; import { InsightsTestingModule } from '../../testing/insights.testing.module';
import { UnitTestingUtils } from '@alfresco/adf-core'; import { UnitTestingUtils } from '@alfresco/adf-core';
import { RaphaelCircleDirective } from '@alfresco/adf-insights'; import { RaphaelCircleDirective } from '@alfresco/adf-insights';
import { DiagramsService } from '../services/diagrams.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('Diagrams throw', () => { describe('Diagrams throw', () => {
let component: any; let component: any;
let fixture: ComponentFixture<DiagramComponent>; let fixture: ComponentFixture<DiagramComponent>;
let unitTestingUtils: UnitTestingUtils; let unitTestingUtils: UnitTestingUtils;
let diagramsService: DiagramsService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [InsightsTestingModule] imports: [InsightsTestingModule]
}); });
jasmine.Ajax.install();
fixture = TestBed.createComponent(DiagramComponent); fixture = TestBed.createComponent(DiagramComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
unitTestingUtils = new UnitTestingUtils(fixture.debugElement); unitTestingUtils = new UnitTestingUtils(fixture.debugElement);
diagramsService = TestBed.inject(DiagramsService);
component.processInstanceId = '38399'; component.processInstanceId = '38399';
component.processDefinitionId = 'fakeprocess:24:38399'; component.processDefinitionId = 'fakeprocess:24:38399';
component.metricPercentages = { startEvent: 0 }; component.metricPercentages = { startEvent: 0 };
@@ -47,17 +48,8 @@ describe('Diagrams throw', () => {
afterEach(() => { afterEach(() => {
fixture.destroy(); fixture.destroy();
jasmine.Ajax.uninstall();
}); });
const ajaxReply = (resp: any) => {
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: resp
});
};
describe('Diagrams component Throw events with process instance id: ', () => { describe('Diagrams component Throw events with process instance id: ', () => {
it('Should render the Throw time event', (done) => { it('Should render the Throw time event', (done) => {
component.success.subscribe((res) => { component.success.subscribe((res) => {
@@ -81,9 +73,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwTimeEvent] }; const resp = { elements: [throwEventMock.throwTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Throw time event', (done) => { it('Should render the Active Throw time event', (done) => {
@@ -112,9 +104,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwTimeEventActive] }; const resp = { elements: [throwEventMock.throwTimeEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Throw time event', (done) => { it('Should render the Completed Throw time event', (done) => {
@@ -143,9 +135,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwTimeEventCompleted] }; const resp = { elements: [throwEventMock.throwTimeEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw error event', (done) => { it('Should render the Throw error event', (done) => {
@@ -174,9 +166,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwErrorEvent] }; const resp = { elements: [throwEventMock.throwErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Throw error event', (done) => { it('Should render the Active Throw error event', (done) => {
@@ -209,9 +201,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwErrorEventActive] }; const resp = { elements: [throwEventMock.throwErrorEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Throw error event', (done) => { it('Should render the Completed Throw error event', (done) => {
@@ -244,9 +236,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwErrorEventCompleted] }; const resp = { elements: [throwEventMock.throwErrorEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal event', (done) => { it('Should render the Throw signal event', (done) => {
@@ -275,9 +267,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwSignalEvent] }; const resp = { elements: [throwEventMock.throwSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Throw signal event', (done) => { it('Should render the Active Throw signal event', (done) => {
@@ -310,9 +302,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwSignalEventActive] }; const resp = { elements: [throwEventMock.throwSignalEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Throw signal event', (done) => { it('Should render the Completed Throw signal event', (done) => {
@@ -345,9 +337,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwSignalEventCompleted] }; const resp = { elements: [throwEventMock.throwSignalEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal message', (done) => { it('Should render the Throw signal message', (done) => {
@@ -376,9 +368,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEvent] }; const resp = { elements: [throwEventMock.throwMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Throw signal message', (done) => { it('Should render the Active Throw signal message', (done) => {
@@ -411,9 +403,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEventActive] }; const resp = { elements: [throwEventMock.throwMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Throw signal message', (done) => { it('Should render the Completed Throw signal message', (done) => {
@@ -446,9 +438,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEventCompleted] }; const resp = { elements: [throwEventMock.throwMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal message', (done) => { it('Should render the Throw signal message', (done) => {
@@ -477,9 +469,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEvent] }; const resp = { elements: [throwEventMock.throwMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Active Throw signal message', (done) => { it('Should render the Active Throw signal message', (done) => {
@@ -512,9 +504,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEventActive] }; const resp = { elements: [throwEventMock.throwMessageEventActive] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Completed Throw signal message', (done) => { it('Should render the Completed Throw signal message', (done) => {
@@ -547,9 +539,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEventCompleted] }; const resp = { elements: [throwEventMock.throwMessageEventCompleted] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
@@ -576,9 +568,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwTimeEvent] }; const resp = { elements: [throwEventMock.throwTimeEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw error event', (done) => { it('Should render the Throw error event', (done) => {
@@ -607,9 +599,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwErrorEvent] }; const resp = { elements: [throwEventMock.throwErrorEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal event', (done) => { it('Should render the Throw signal event', (done) => {
@@ -638,9 +630,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwSignalEvent] }; const resp = { elements: [throwEventMock.throwSignalEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal message', (done) => { it('Should render the Throw signal message', (done) => {
@@ -669,9 +661,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEvent] }; const resp = { elements: [throwEventMock.throwMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
it('Should render the Throw signal message', (done) => { it('Should render the Throw signal message', (done) => {
@@ -700,9 +692,9 @@ describe('Diagrams throw', () => {
done(); done();
}); });
}); });
component.ngOnChanges();
const resp = { elements: [throwEventMock.throwMessageEvent] }; const resp = { elements: [throwEventMock.throwMessageEvent] };
ajaxReply(resp); spyOn(diagramsService, 'getProcessDefinitionModel').and.returnValue(of(resp));
component.ngOnChanges();
}); });
}); });
}); });
+3 -8
View File
@@ -22,7 +22,7 @@ module.exports = function (config) {
{ pattern: 'lib/process-services-cloud/**/*.ts', included: false, served: true, watched: false }, { pattern: 'lib/process-services-cloud/**/*.ts', included: false, served: true, watched: false },
{ pattern: 'lib/config/app.config.json', included: false, served: true, watched: false } { pattern: 'lib/config/app.config.json', included: false, served: true, watched: false }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
proxies: { proxies: {
'/assets/': '/base/lib/process-services-cloud/src/lib/assets/', '/assets/': '/base/lib/process-services-cloud/src/lib/assets/',
'/resources/i18n/en.json': '/base/lib/process-services-cloud/src/lib/mock/en.json', '/resources/i18n/en.json': '/base/lib/process-services-cloud/src/lib/mock/en.json',
@@ -35,13 +35,11 @@ module.exports = function (config) {
'/app.config.json': '/base/lib/config/app.config.json' '/app.config.json': '/base/lib/config/app.config.json'
}, },
plugins: [ plugins: [
require('karma-jasmine-ajax'),
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false, clearContext: false,
@@ -52,9 +50,6 @@ module.exports = function (config) {
jasmineHtmlReporter: { jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/process-services-cloud'), dir: join(__dirname, '../../coverage/process-services-cloud'),
@@ -77,7 +72,7 @@ module.exports = function (config) {
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
+3 -8
View File
@@ -22,7 +22,7 @@ module.exports = function (config) {
{ pattern: 'lib/process-services/**/*.ts', included: false, served: true, watched: false }, { pattern: 'lib/process-services/**/*.ts', included: false, served: true, watched: false },
{ pattern: 'lib/config/app.config.json', included: false, served: true, watched: false } { pattern: 'lib/config/app.config.json', included: false, served: true, watched: false }
], ],
frameworks: ['jasmine-ajax', 'jasmine', '@angular-devkit/build-angular'], frameworks: ['jasmine', '@angular-devkit/build-angular'],
proxies: { proxies: {
'/assets/': '/base/lib/process-services/src/lib/assets/', '/assets/': '/base/lib/process-services/src/lib/assets/',
'/assets/adf-core/i18n/en.json': '/base/lib/core/src/lib/i18n/en.json', '/assets/adf-core/i18n/en.json': '/base/lib/core/src/lib/i18n/en.json',
@@ -31,13 +31,11 @@ module.exports = function (config) {
'/app.config.json': '/base/lib/config/app.config.json' '/app.config.json': '/base/lib/config/app.config.json'
}, },
plugins: [ plugins: [
require('karma-jasmine-ajax'),
require('karma-jasmine'), require('karma-jasmine'),
require('karma-chrome-launcher'), require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'), require('karma-jasmine-html-reporter'),
require('karma-coverage'), require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma'), require('@angular-devkit/build-angular/plugins/karma')
require('karma-mocha-reporter')
], ],
client: { client: {
clearContext: false, clearContext: false,
@@ -48,9 +46,6 @@ module.exports = function (config) {
jasmineHtmlReporter: { jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces suppressAll: true // removes the duplicated traces
}, },
mochaReporter: {
ignoreSkipped: process.env.KARMA_IGNORE_SKIPPED === 'true'
},
coverageReporter: { coverageReporter: {
dir: join(__dirname, '../../coverage/process-services'), dir: join(__dirname, '../../coverage/process-services'),
subdir: '.', subdir: '.',
@@ -72,7 +67,7 @@ module.exports = function (config) {
} }
}, },
reporters: ['mocha', 'kjhtml'], reporters: ['progress', 'kjhtml'],
port: 9876, port: 9876,
colors: true, colors: true,
logLevel: constants.LOG_INFO, logLevel: constants.LOG_INFO,
@@ -19,13 +19,14 @@ import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateProcessAttachmentComponent } from './create-process-attachment.component'; import { CreateProcessAttachmentComponent } from './create-process-attachment.component';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
import { ProcessContentService } from '../../form/services/process-content.service';
declare let jasmine: any; import { of } from 'rxjs';
describe('CreateProcessAttachmentComponent', () => { describe('CreateProcessAttachmentComponent', () => {
let component: CreateProcessAttachmentComponent; let component: CreateProcessAttachmentComponent;
let fixture: ComponentFixture<CreateProcessAttachmentComponent>; let fixture: ComponentFixture<CreateProcessAttachmentComponent>;
let element: HTMLElement; let element: HTMLElement;
let processContentService: ProcessContentService;
const file = new File([new Blob()], 'Test'); const file = new File([new Blob()], 'Test');
const fileObj = { entry: null, file, relativeFolder: '/' }; const fileObj = { entry: null, file, relativeFolder: '/' };
@@ -53,19 +54,12 @@ describe('CreateProcessAttachmentComponent', () => {
fixture = TestBed.createComponent(CreateProcessAttachmentComponent); fixture = TestBed.createComponent(CreateProcessAttachmentComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
element = fixture.nativeElement; element = fixture.nativeElement;
processContentService = TestBed.inject(ProcessContentService);
component.processInstanceId = '9999'; component.processInstanceId = '9999';
fixture.detectChanges(); fixture.detectChanges();
}); });
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should update the processInstanceId when it is changed', () => { it('should update the processInstanceId when it is changed', () => {
component.processInstanceId = null; component.processInstanceId = null;
@@ -76,20 +70,17 @@ describe('CreateProcessAttachmentComponent', () => {
}); });
it('should emit content created event when the file is uploaded', (done) => { it('should emit content created event when the file is uploaded', (done) => {
spyOn(processContentService, 'createProcessRelatedContent').and.returnValue(of(fakeUploadResponse) as any);
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res).not.toBeNull(); expect(res).not.toBeNull();
expect(res.id).toBe(9999); expect(res.id).toBe(9999);
expect(processContentService.createProcessRelatedContent).toHaveBeenCalledWith('9999', file, { isRelatedContent: true });
done(); done();
}); });
component.onFileUpload(customEvent); component.onFileUpload(customEvent);
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeUploadResponse)
});
}); });
it('should allow user to upload files via button', (done) => { it('should allow user to upload files via button', (done) => {
@@ -97,6 +88,8 @@ describe('CreateProcessAttachmentComponent', () => {
expect(buttonUpload).toBeDefined(); expect(buttonUpload).toBeDefined();
expect(buttonUpload).not.toBeNull(); expect(buttonUpload).not.toBeNull();
spyOn(processContentService, 'createProcessRelatedContent').and.returnValue(of(fakeUploadResponse) as any);
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res).not.toBeNull(); expect(res).not.toBeNull();
@@ -107,11 +100,5 @@ describe('CreateProcessAttachmentComponent', () => {
const dropEvent = new CustomEvent('upload-files', customEvent); const dropEvent = new CustomEvent('upload-files', customEvent);
buttonUpload.dispatchEvent(dropEvent); buttonUpload.dispatchEvent(dropEvent);
fixture.detectChanges(); fixture.detectChanges();
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeUploadResponse)
});
}); });
}); });
@@ -21,8 +21,6 @@ import { EcmModelService } from './ecm-model.service';
import { TestBed } from '@angular/core/testing'; import { TestBed } from '@angular/core/testing';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
declare let jasmine: any;
describe('EcmModelService', () => { describe('EcmModelService', () => {
let service: EcmModelService; let service: EcmModelService;
@@ -32,76 +30,48 @@ describe('EcmModelService', () => {
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
}); });
service = TestBed.inject(EcmModelService); service = TestBed.inject(EcmModelService);
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
}); });
it('Should fetch ECM models', (done) => { it('Should fetch ECM models', (done) => {
service.getEcmModels().subscribe(() => { spyOn(service.customModelApi, 'getAllCustomModel').and.returnValue(Promise.resolve({} as any));
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('alfresco/versions/1/cmm')).toBeTruthy();
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.getEcmModels().subscribe(() => {
status: 200, expect(service.customModelApi.getAllCustomModel).toHaveBeenCalled();
contentType: 'application/json', done();
responseText: JSON.stringify({})
}); });
}); });
it('Should fetch ECM types', (done) => { it('Should fetch ECM types', (done) => {
const modelName = 'modelTest'; const modelName = 'modelTest';
spyOn(service.customModelApi, 'getAllCustomType').and.returnValue(Promise.resolve({} as any));
service.getEcmType(modelName).subscribe(() => { service.getEcmType(modelName).subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('versions/1/cmm/' + modelName + '/types')).toBeTruthy(); expect(service.customModelApi.getAllCustomType).toHaveBeenCalledWith(modelName);
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({})
});
}); });
it('Should create ECM types', (done) => { it('Should create ECM types', (done) => {
const typeName = 'typeTest'; const typeName = 'typeTest';
const mockResponse = { entry: { name: typeName } };
const createTypeSpy = spyOn(service.customModelApi, 'createCustomType').and.returnValue(Promise.resolve(mockResponse as any));
service.createEcmType(typeName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(() => { service.createEcmType(typeName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('versions/1/cmm/' + EcmModelService.MODEL_NAME + '/types')).toBeTruthy(); expect(createTypeSpy).toHaveBeenCalledWith(EcmModelService.MODEL_NAME, typeName, EcmModelService.TYPE_MODEL, typeName, '');
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toEqual(typeName);
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).title).toEqual(typeName);
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).parentName).toEqual(EcmModelService.TYPE_MODEL);
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({})
});
}); });
it('Should create ECM types with a clean and preserve real name in the title', (done) => { it('Should create ECM types with a clean and preserve real name in the title', (done) => {
const typeName = 'typeTest:testName@#$*!'; const typeName = 'typeTest:testName@#$*!';
const cleanName = 'testName'; const cleanName = 'testName';
const mockResponse = { entry: { name: cleanName } };
const createTypeSpy = spyOn(service.customModelApi, 'createCustomType').and.returnValue(Promise.resolve(mockResponse as any));
service.createEcmType(typeName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(() => { service.createEcmType(typeName, EcmModelService.MODEL_NAME, EcmModelService.TYPE_MODEL).subscribe(() => {
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('versions/1/cmm/' + EcmModelService.MODEL_NAME + '/types')).toBeTruthy(); expect(createTypeSpy).toHaveBeenCalledWith(EcmModelService.MODEL_NAME, cleanName, EcmModelService.TYPE_MODEL, typeName, '');
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).name).toEqual(cleanName);
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).title).toEqual(typeName);
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).parentName).toEqual(EcmModelService.TYPE_MODEL);
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({})
});
}); });
it('Should add property to a type', (done) => { it('Should add property to a type', (done) => {
@@ -113,37 +83,26 @@ describe('EcmModelService', () => {
} }
}; };
service.addPropertyToAType(EcmModelService.MODEL_NAME, typeName, formFields).subscribe(() => { const mockResponse = { entry: { properties: [] } };
expect( const addPropertySpy = spyOn(service.customModelApi, 'addPropertyToType').and.returnValue(Promise.resolve(mockResponse as any));
jasmine.Ajax.requests.mostRecent().url.endsWith('1/cmm/' + EcmModelService.MODEL_NAME + '/types/' + typeName + '?select=props')
).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).properties).toEqual([
{
name: 'test',
title: 'test',
description: 'test',
dataType: 'd:text',
multiValued: false,
mandatory: false,
mandatoryEnforced: false
},
{
name: 'test2',
title: 'test2',
description: 'test2',
dataType: 'd:text',
multiValued: false,
mandatory: false,
mandatoryEnforced: false
}
]);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.addPropertyToAType(EcmModelService.MODEL_NAME, typeName, formFields).subscribe(() => {
status: 200, const callArgs = addPropertySpy.calls.mostRecent().args;
contentType: 'application/json', expect(callArgs[0]).toEqual(EcmModelService.MODEL_NAME);
responseText: JSON.stringify({}) expect(callArgs[1]).toEqual(typeName);
expect(callArgs[2]).toEqual(
jasmine.arrayContaining([
jasmine.objectContaining({
name: 'test',
title: 'test'
}),
jasmine.objectContaining({
name: 'test2',
title: 'test2'
})
])
);
done();
}); });
}); });
@@ -157,67 +116,52 @@ describe('EcmModelService', () => {
} }
}; };
service.addPropertyToAType(EcmModelService.MODEL_NAME, typeName, formFields).subscribe(() => { const mockResponse = { entry: { properties: [] } };
expect( const addPropertySpy = spyOn(service.customModelApi, 'addPropertyToType').and.returnValue(Promise.resolve(mockResponse as any));
jasmine.Ajax.requests.mostRecent().url.endsWith('1/cmm/' + EcmModelService.MODEL_NAME + '/types/' + cleanName + '?select=props')
).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).properties).toEqual([
{
name: 'test',
title: 'test',
description: 'test',
dataType: 'd:text',
multiValued: false,
mandatory: false,
mandatoryEnforced: false
},
{
name: 'test2',
title: 'test2',
description: 'test2',
dataType: 'd:text',
multiValued: false,
mandatory: false,
mandatoryEnforced: false
}
]);
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.addPropertyToAType(EcmModelService.MODEL_NAME, typeName, formFields).subscribe(() => {
status: 200, const callArgs = addPropertySpy.calls.mostRecent().args;
contentType: 'application/json', expect(callArgs[0]).toEqual(EcmModelService.MODEL_NAME);
responseText: JSON.stringify({}) expect(callArgs[1]).toEqual(cleanName);
expect(callArgs[2]).toEqual(
jasmine.arrayContaining([
jasmine.objectContaining({
name: 'test',
title: 'test'
}),
jasmine.objectContaining({
name: 'test2',
title: 'test2'
})
])
);
done();
}); });
}); });
it('Should create ECM model', (done) => { it('Should create ECM model', (done) => {
service.createEcmModel(EcmModelService.MODEL_NAME, EcmModelService.MODEL_NAMESPACE).subscribe(() => { const mockResponse = { entry: { name: EcmModelService.MODEL_NAME } };
expect(jasmine.Ajax.requests.mostRecent().url.endsWith('alfresco/versions/1/cmm')).toBeTruthy(); const createModelSpy = spyOn(service.customModelApi, 'createCustomModel').and.returnValue(Promise.resolve(mockResponse as any));
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).status).toEqual('DRAFT');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.createEcmModel(EcmModelService.MODEL_NAME, EcmModelService.MODEL_NAMESPACE).subscribe(() => {
status: 200, expect(createModelSpy).toHaveBeenCalledWith(
contentType: 'application/json', 'DRAFT',
responseText: JSON.stringify({}) '',
EcmModelService.MODEL_NAME,
EcmModelService.MODEL_NAME,
EcmModelService.MODEL_NAMESPACE
);
done();
}); });
}); });
it('Should activate ECM model', (done) => { it('Should activate ECM model', (done) => {
service.activeEcmModel(EcmModelService.MODEL_NAME).subscribe(() => { const mockResponse = { entry: { status: 'ACTIVE' } };
expect( const activateModelSpy = spyOn(service.customModelApi, 'activateCustomModel').and.returnValue(Promise.resolve(mockResponse as any));
jasmine.Ajax.requests.mostRecent().url.endsWith('alfresco/versions/1/cmm/' + EcmModelService.MODEL_NAME + '?select=status')
).toBeTruthy();
expect(JSON.parse(jasmine.Ajax.requests.mostRecent().params).status).toEqual('ACTIVE');
done();
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.activeEcmModel(EcmModelService.MODEL_NAME).subscribe(() => {
status: 200, expect(activateModelSpy).toHaveBeenCalledWith(EcmModelService.MODEL_NAME);
contentType: 'application/json', done();
responseText: JSON.stringify({})
}); });
}); });
@@ -19,8 +19,6 @@ import { TestBed } from '@angular/core/testing';
import { ProcessContentService } from './process-content.service'; import { ProcessContentService } from './process-content.service';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
declare let jasmine: any;
const fileContentPdfResponseBody = { const fileContentPdfResponseBody = {
id: 999, id: 999,
name: 'fake-name.pdf', name: 'fake-name.pdf',
@@ -71,15 +69,43 @@ describe('ProcessContentService', () => {
service = TestBed.inject(ProcessContentService); service = TestBed.inject(ProcessContentService);
}); });
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('Should fetch the attachments', (done) => { it('Should fetch the attachments', (done) => {
const mockResponse = {
size: 2,
total: 2,
start: 0,
data: [
{
id: 8,
name: 'fake.zip',
created: 1494595697381,
createdBy: { id: 2, firstName: 'user', lastName: 'user', email: 'user@user.com' },
relatedContent: true,
contentAvailable: true,
link: false,
mimeType: 'application/zip',
simpleType: 'content',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
},
{
id: 9,
name: 'fake.jpg',
created: 1494595655381,
createdBy: { id: 2, firstName: 'user', lastName: 'user', email: 'user@user.com' },
relatedContent: true,
contentAvailable: true,
link: false,
mimeType: 'image/jpeg',
simpleType: 'image',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
}
]
};
spyOn(service.contentApi, 'getRelatedContentForTask').and.returnValue(Promise.resolve(mockResponse as any));
service.getTaskRelatedContent('1234').subscribe((res) => { service.getTaskRelatedContent('1234').subscribe((res) => {
expect(res.data).toBeDefined(); expect(res.data).toBeDefined();
expect(res.data.length).toBe(2); expect(res.data.length).toBe(2);
@@ -91,49 +117,13 @@ describe('ProcessContentService', () => {
expect(res.data[1].relatedContent).toBeTruthy(); expect(res.data[1].relatedContent).toBeTruthy();
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
size: 2,
total: 2,
start: 0,
data: [
{
id: 8,
name: 'fake.zip',
created: 1494595697381,
createdBy: { id: 2, firstName: 'user', lastName: 'user', email: 'user@user.com' },
relatedContent: true,
contentAvailable: true,
link: false,
mimeType: 'application/zip',
simpleType: 'content',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
},
{
id: 9,
name: 'fake.jpg',
created: 1494595655381,
createdBy: { id: 2, firstName: 'user', lastName: 'user', email: 'user@user.com' },
relatedContent: true,
contentAvailable: true,
link: false,
mimeType: 'image/jpeg',
simpleType: 'image',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
}
]
})
});
}); });
it('should return the unsupported content when the file is an image', (done) => { it('should return the unsupported content when the file is an image', (done) => {
const contentId: number = 888; const contentId: number = 888;
spyOn(service.contentApi, 'getContent').and.returnValue(Promise.resolve(fileContentJpgResponseBody as any));
service.getFileContent(contentId).subscribe((result) => { service.getFileContent(contentId).subscribe((result) => {
expect(result.id).toEqual(contentId); expect(result.id).toEqual(contentId);
expect(result.name).toEqual('fake-name.jpg'); expect(result.name).toEqual('fake-name.jpg');
@@ -141,17 +131,13 @@ describe('ProcessContentService', () => {
expect(result.thumbnailStatus).toEqual('unsupported'); expect(result.thumbnailStatus).toEqual('unsupported');
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fileContentJpgResponseBody)
});
}); });
it('should return the supported content when the file is a pdf', (done) => { it('should return the supported content when the file is a pdf', (done) => {
const contentId: number = 999; const contentId: number = 999;
spyOn(service.contentApi, 'getContent').and.returnValue(Promise.resolve(fileContentPdfResponseBody as any));
service.getFileContent(contentId).subscribe((result) => { service.getFileContent(contentId).subscribe((result) => {
expect(result.id).toEqual(contentId); expect(result.id).toEqual(contentId);
expect(result.name).toEqual('fake-name.pdf'); expect(result.name).toEqual('fake-name.pdf');
@@ -159,12 +145,6 @@ describe('ProcessContentService', () => {
expect(result.thumbnailStatus).toEqual('created'); expect(result.thumbnailStatus).toEqual('created');
done(); done();
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fileContentPdfResponseBody)
});
}); });
it('should return the raw content URL', () => { it('should return the raw content URL', () => {
@@ -24,8 +24,6 @@ import { ContentWidgetComponent } from './content.widget';
import { ProcessContentService } from '../../services/process-content.service'; import { ProcessContentService } from '../../services/process-content.service';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
declare let jasmine: any;
describe('ContentWidgetComponent', () => { describe('ContentWidgetComponent', () => {
let component: ContentWidgetComponent; let component: ContentWidgetComponent;
let fixture: ComponentFixture<ContentWidgetComponent>; let fixture: ComponentFixture<ContentWidgetComponent>;
@@ -75,14 +73,6 @@ describe('ContentWidgetComponent', () => {
}); });
describe('Rendering tests', () => { describe('Rendering tests', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should display content thumbnail', () => { it('should display content thumbnail', () => {
component.showDocumentContent = true; component.showDocumentContent = true;
component.content = new ContentLinkModel(); component.content = new ContentLinkModel();
@@ -94,6 +84,26 @@ describe('ContentWidgetComponent', () => {
it('should load the thumbnail preview of the png image', fakeAsync(() => { it('should load the thumbnail preview of the png image', fakeAsync(() => {
const blob = createFakeImageBlob(); const blob = createFakeImageBlob();
const mockResponse = {
id: 4004,
name: 'Useful expressions - Email_English.png',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
link: false,
mimeType: 'image/png',
simpleType: 'image',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
};
spyOn(processContentService, 'getFileContent').and.returnValue(of(mockResponse as any));
spyOn(processContentService, 'getFileRawContent').and.returnValue(of(blob)); spyOn(processContentService, 'getFileRawContent').and.returnValue(of(blob));
component.thumbnailLoaded.subscribe((res) => { component.thumbnailLoaded.subscribe((res) => {
@@ -109,33 +119,30 @@ describe('ContentWidgetComponent', () => {
const contentId = 1; const contentId = 1;
const change = new SimpleChange(null, contentId, true); const change = new SimpleChange(null, contentId, true);
component.ngOnChanges({ id: change }); component.ngOnChanges({ id: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {
id: 4004,
name: 'Useful expressions - Email_English.png',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
link: false,
mimeType: 'image/png',
simpleType: 'image',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
}
});
})); }));
it('should load the thumbnail preview of a pdf', fakeAsync(() => { it('should load the thumbnail preview of a pdf', fakeAsync(() => {
const blob = createFakePdfBlob(); const blob = createFakePdfBlob();
const mockResponse = {
id: 4004,
name: 'FakeBlob.pdf',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
link: false,
mimeType: 'application/pdf',
simpleType: 'pdf',
previewStatus: 'created',
thumbnailStatus: 'created'
};
spyOn(processContentService, 'getFileContent').and.returnValue(of(mockResponse as any));
spyOn(processContentService, 'getContentThumbnail').and.returnValue(of(blob)); spyOn(processContentService, 'getContentThumbnail').and.returnValue(of(blob));
component.thumbnailLoaded.subscribe((res) => { component.thumbnailLoaded.subscribe((res) => {
@@ -151,32 +158,30 @@ describe('ContentWidgetComponent', () => {
const contentId = 1; const contentId = 1;
const change = new SimpleChange(null, contentId, true); const change = new SimpleChange(null, contentId, true);
component.ngOnChanges({ id: change }); component.ngOnChanges({ id: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {
id: 4004,
name: 'FakeBlob.pdf',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: true,
link: false,
mimeType: 'application/pdf',
simpleType: 'pdf',
previewStatus: 'created',
thumbnailStatus: 'created'
}
});
})); }));
it('should show unsupported preview with unsupported file', fakeAsync(() => { it('should show unsupported preview with unsupported file', fakeAsync(() => {
const mockResponse = {
id: 4004,
name: 'FakeBlob.zip',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: false,
link: false,
mimeType: 'application/zip',
simpleType: 'zip',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
};
spyOn(processContentService, 'getFileContent').and.returnValue(of(mockResponse as any));
const contentId = 1; const contentId = 1;
const change = new SimpleChange(null, contentId, true); const change = new SimpleChange(null, contentId, true);
component.ngOnChanges({ id: change }); component.ngOnChanges({ id: change });
@@ -187,29 +192,6 @@ describe('ContentWidgetComponent', () => {
expect(thumbnailPreview).toBeDefined(); expect(thumbnailPreview).toBeDefined();
expect(element.querySelector('div.upload-widget__content-text').innerHTML).toEqual('FakeBlob.zip'); expect(element.querySelector('div.upload-widget__content-text').innerHTML).toEqual('FakeBlob.zip');
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {
id: 4004,
name: 'FakeBlob.zip',
created: 1490354907883,
createdBy: {
id: 2,
firstName: 'admin',
lastName: 'admin',
email: 'administrator@admin.com'
},
relatedContent: false,
contentAvailable: false,
link: false,
mimeType: 'application/zip',
simpleType: 'zip',
previewStatus: 'unsupported',
thumbnailStatus: 'unsupported'
}
});
})); }));
it('should open the viewer when the view button is clicked', () => { it('should open the viewer when the view button is clicked', () => {
@@ -21,8 +21,6 @@ import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresent
import { of } from 'rxjs'; import { of } from 'rxjs';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
declare let jasmine: any;
const fakeProcessFiltersResponse: any = { const fakeProcessFiltersResponse: any = {
size: 1, size: 1,
total: 1, total: 1,
@@ -60,12 +58,6 @@ describe('Process filter', () => {
beforeEach(() => { beforeEach(() => {
getFilters = spyOn(service.userFiltersApi, 'getUserProcessInstanceFilters').and.returnValue(Promise.resolve(fakeProcessFiltersResponse)); getFilters = spyOn(service.userFiltersApi, 'getUserProcessInstanceFilters').and.returnValue(Promise.resolve(fakeProcessFiltersResponse));
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
}); });
describe('get filters', () => { describe('get filters', () => {
@@ -102,6 +94,30 @@ describe('Process filter', () => {
}); });
it('should return the default filters', (done) => { it('should return the default filters', (done) => {
const runningFilterResponse = {
appId: 1001,
id: 111,
name: 'Running',
icon: 'fake-icon',
recent: false
};
const completedFilterResponse = {
appId: 1001,
id: 222,
name: 'Completed',
icon: 'fake-icon',
recent: false
};
const allFilterResponse = {
appId: 1001,
id: 333,
name: 'All',
icon: 'fake-icon',
recent: false
};
spyOn(service, 'addProcessFilter').and.returnValues(of(runningFilterResponse), of(completedFilterResponse), of(allFilterResponse));
service.createDefaultFilters(1234).subscribe((res) => { service.createDefaultFilters(1234).subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.length).toEqual(3); expect(res.length).toEqual(3);
@@ -113,45 +129,33 @@ describe('Process filter', () => {
expect(res[2].id).toEqual(333); expect(res[2].id).toEqual(333);
done(); done();
}); });
jasmine.Ajax.requests.at(0).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 111,
name: 'Running',
icon: 'fake-icon',
recent: false
})
});
jasmine.Ajax.requests.at(1).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 222,
name: 'Completed',
icon: 'fake-icon',
recent: false
})
});
jasmine.Ajax.requests.at(2).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 333,
name: 'All',
icon: 'fake-icon',
recent: false
})
});
}); });
it('should be able create filters and add sorting information to the response', (done) => { it('should be able create filters and add sorting information to the response', (done) => {
const runningFilterResponse = {
appId: 1001,
id: 111,
name: 'Running',
icon: 'fake-icon',
recent: false
};
const completedFilterResponse = {
appId: 1001,
id: 222,
name: 'Completed',
icon: 'fake-icon',
recent: false
};
const allFilterResponse = {
appId: 1001,
id: 333,
name: 'All',
icon: 'fake-icon',
recent: false
};
spyOn(service, 'addProcessFilter').and.returnValues(of(runningFilterResponse), of(completedFilterResponse), of(allFilterResponse));
service.createDefaultFilters(1234).subscribe((res) => { service.createDefaultFilters(1234).subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.length).toEqual(3); expect(res.length).toEqual(3);
@@ -168,42 +172,6 @@ describe('Process filter', () => {
expect(res[2].filter.state).toEqual('all'); expect(res[2].filter.state).toEqual('all');
done(); done();
}); });
jasmine.Ajax.requests.at(0).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 111,
name: 'Running',
icon: 'fake-icon',
recent: false
})
});
jasmine.Ajax.requests.at(1).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 222,
name: 'Completed',
icon: 'fake-icon',
recent: false
})
});
jasmine.Ajax.requests.at(2).respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify({
appId: 1001,
id: 333,
name: 'All',
icon: 'fake-icon',
recent: false
})
});
}); });
it('should pass on any error that is returned by the API', (done) => { it('should pass on any error that is returned by the API', (done) => {
@@ -20,8 +20,6 @@ import { PeopleProcessService } from './people-process.service';
import { LightUserRepresentation } from '@alfresco/js-api'; import { LightUserRepresentation } from '@alfresco/js-api';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
declare let jasmine: any;
const firstInvolvedUser: LightUserRepresentation = { const firstInvolvedUser: LightUserRepresentation = {
id: 1, id: 1,
email: 'fake-user1@fake.com', email: 'fake-user1@fake.com',
@@ -51,15 +49,9 @@ describe('PeopleProcessService', () => {
}); });
describe('when user is logged in', () => { describe('when user is logged in', () => {
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => {
jasmine.Ajax.uninstall();
});
it('should be able to retrieve people to involve in the task', fakeAsync(() => { it('should be able to retrieve people to involve in the task', fakeAsync(() => {
spyOn(service.userApi, 'getUsers').and.returnValue(Promise.resolve({ data: fakeInvolveUserList } as any));
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => { service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => {
expect(users).toBeDefined(); expect(users).toBeDefined();
expect(users.length).toBe(2); expect(users.length).toBe(2);
@@ -68,27 +60,17 @@ describe('PeopleProcessService', () => {
expect(users[0].firstName).toEqual('fakeName1'); expect(users[0].firstName).toEqual('fakeName1');
expect(users[0].lastName).toEqual('fakeLast1'); expect(users[0].lastName).toEqual('fakeLast1');
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: { data: fakeInvolveUserList }
});
})); }));
it('should be able to get people images for people retrieved', fakeAsync(() => { it('should be able to get people images for people retrieved', fakeAsync(() => {
spyOn(service.userApi, 'getUsers').and.returnValue(Promise.resolve({ data: fakeInvolveUserList } as any));
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => { service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => {
expect(users).toBeDefined(); expect(users).toBeDefined();
expect(users.length).toBe(2); expect(users.length).toBe(2);
expect(service.getUserImage(users[0].id.toString())).toContain('/users/' + users[0].id + '/picture'); expect(service.getUserImage(users[0].id.toString())).toContain('/users/' + users[0].id + '/picture');
expect(service.getUserImage(users[1].id.toString())).toContain('/users/' + users[1].id + '/picture'); expect(service.getUserImage(users[1].id.toString())).toContain('/users/' + users[1].id + '/picture');
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: { data: fakeInvolveUserList }
});
})); }));
it('should return user image url', () => { it('should return user image url', () => {
@@ -98,77 +80,61 @@ describe('PeopleProcessService', () => {
}); });
it('should return empty list when there are no users to involve', fakeAsync(() => { it('should return empty list when there are no users to involve', fakeAsync(() => {
spyOn(service.userApi, 'getUsers').and.returnValue(Promise.resolve({} as any));
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => { service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe((users) => {
expect(users).toBeDefined(); expect(users).toBeDefined();
expect(users.length).toBe(0); expect(users.length).toBe(0);
}); });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'json',
responseText: {}
});
})); }));
it('getWorkflowUsers catch errors call', fakeAsync(() => { it('getWorkflowUsers catch errors call', fakeAsync(() => {
spyOn(service.userApi, 'getUsers').and.returnValue(Promise.reject(errorResponse));
service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe( service.getWorkflowUsers('fake-task-id', 'fake-filter').subscribe(
() => {}, () => {},
(error) => { (error) => {
expect(error).toEqual(errorResponse); expect(error).toEqual(errorResponse);
} }
); );
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
})); }));
it('should be able to involve people in the task', fakeAsync(() => { it('should be able to involve people in the task', fakeAsync(() => {
service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe(() => { const involveSpy = spyOn(service.taskActionsApi, 'involveUser').and.returnValue(Promise.resolve([] as any));
expect(jasmine.Ajax.requests.mostRecent().method).toBe('PUT');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('tasks/fake-task-id/action/involve');
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe(() => {
status: 200 expect(involveSpy).toHaveBeenCalledWith('fake-task-id', { userId: 'fake-user-id' });
}); });
})); }));
it('involveUserWithTask catch errors call', fakeAsync(() => { it('involveUserWithTask catch errors call', fakeAsync(() => {
spyOn(service.taskActionsApi, 'involveUser').and.returnValue(Promise.reject(errorResponse));
service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe( service.involveUserWithTask('fake-task-id', 'fake-user-id').subscribe(
() => {}, () => {},
(error) => { (error) => {
expect(error).toEqual(errorResponse); expect(error).toEqual(errorResponse);
} }
); );
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
})); }));
it('should be able to remove involved people from task', fakeAsync(() => { it('should be able to remove involved people from task', fakeAsync(() => {
service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe(() => { const removeSpy = spyOn(service.taskActionsApi, 'removeInvolvedUser').and.returnValue(Promise.resolve([] as any));
expect(jasmine.Ajax.requests.mostRecent().method).toBe('PUT');
expect(jasmine.Ajax.requests.mostRecent().url).toContain('tasks/fake-task-id/action/remove-involved');
});
jasmine.Ajax.requests.mostRecent().respondWith({ service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe(() => {
status: 200 expect(removeSpy).toHaveBeenCalledWith('fake-task-id', { userId: 'fake-user-id' });
}); });
})); }));
it('removeInvolvedUser catch errors call', fakeAsync(() => { it('removeInvolvedUser catch errors call', fakeAsync(() => {
spyOn(service.taskActionsApi, 'removeInvolvedUser').and.returnValue(Promise.reject(errorResponse));
service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe( service.removeInvolvedUser('fake-task-id', 'fake-user-id').subscribe(
() => {}, () => {},
(error) => { (error) => {
expect(error).toEqual(errorResponse); expect(error).toEqual(errorResponse);
} }
); );
jasmine.Ajax.requests.mostRecent().respondWith({
status: 403
});
})); }));
}); });
}); });
@@ -42,8 +42,6 @@ import { MatMenuItemHarness } from '@angular/material/menu/testing';
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
declare let jasmine: any;
describe('TaskListComponent', () => { describe('TaskListComponent', () => {
let component: TaskListComponent; let component: TaskListComponent;
let fixture: ComponentFixture<TaskListComponent>; let fixture: ComponentFixture<TaskListComponent>;
@@ -51,16 +49,22 @@ describe('TaskListComponent', () => {
let appConfig: AppConfigService; let appConfig: AppConfigService;
let taskListService: TaskListService; let taskListService: TaskListService;
const transformDates = (taskData: any) => ({
...taskData,
data: taskData.data.map((task: any) => ({
...task,
created: task.created ? new Date(task.created) : undefined,
dueDate: task.dueDate ? new Date(task.dueDate) : undefined,
endDate: task.endDate ? new Date(task.endDate) : undefined
}))
});
const testMostRecentCall = (changes: SimpleChanges) => { const testMostRecentCall = (changes: SimpleChanges) => {
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.ngAfterContentInit(); component.ngAfterContentInit();
component.ngOnChanges(changes); component.ngOnChanges(changes);
fixture.detectChanges(); fixture.detectChanges();
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}; };
const testSubscribeForFilteredTaskList = (done: DoneFn) => { const testSubscribeForFilteredTaskList = (done: DoneFn) => {
@@ -76,7 +80,7 @@ describe('TaskListComponent', () => {
}; };
const testRowSelection = async (selectionMode?: string) => { const testRowSelection = async (selectionMode?: string) => {
spyOn(taskListService, 'findTasksByState').and.returnValues(of(fakeGlobalTask)); spyOn(taskListService, 'findTasksByState').and.returnValues(of(transformDates(fakeGlobalTask)));
const state = new SimpleChange(null, 'open', true); const state = new SimpleChange(null, 'open', true);
component.multiselect = true; component.multiselect = true;
if (selectionMode) { if (selectionMode) {
@@ -129,12 +133,7 @@ describe('TaskListComponent', () => {
}); });
}); });
beforeEach(() => {
jasmine.Ajax.install();
});
afterEach(() => { afterEach(() => {
jasmine.Ajax.uninstall();
fixture.destroy(); fixture.destroy();
}); });
@@ -314,14 +313,11 @@ describe('TaskListComponent', () => {
expect(component.rows[0]['name']).toEqual('nameFake1'); expect(component.rows[0]['name']).toEqual('nameFake1');
done(); done();
}); });
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
fixture.detectChanges(); fixture.detectChanges();
component.reload(); component.reload();
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should emit row click event', (done) => { it('should emit row click event', (done) => {
@@ -363,6 +359,8 @@ describe('TaskListComponent', () => {
const landingTaskId = '888'; const landingTaskId = '888';
const change = new SimpleChange(null, landingTaskId, true); const change = new SimpleChange(null, landingTaskId, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -371,12 +369,6 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ landingTaskId: change }); component.ngOnChanges({ landingTaskId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should NOT reload the task list when no parameters changed', () => { it('should NOT reload the task list when no parameters changed', () => {
@@ -390,6 +382,8 @@ describe('TaskListComponent', () => {
const appId = '1'; const appId = '1';
const change = new SimpleChange(null, appId, true); const change = new SimpleChange(null, appId, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -399,18 +393,14 @@ describe('TaskListComponent', () => {
done(); done();
}); });
component.ngOnChanges({ appId: change }); component.ngOnChanges({ appId: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should reload the list when the processDefinitionKey parameter changes', (done) => { it('should reload the list when the processDefinitionKey parameter changes', (done) => {
const processDefinitionKey = 'fakeprocess'; const processDefinitionKey = 'fakeprocess';
const change = new SimpleChange(null, processDefinitionKey, true); const change = new SimpleChange(null, processDefinitionKey, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -421,18 +411,14 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ processDefinitionKey: change }); component.ngOnChanges({ processDefinitionKey: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should reload the list when the state parameter changes', (done) => { it('should reload the list when the state parameter changes', (done) => {
const state = 'open'; const state = 'open';
const change = new SimpleChange(null, state, true); const change = new SimpleChange(null, state, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -443,18 +429,14 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ state: change }); component.ngOnChanges({ state: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should reload the list when the sort parameter changes', (done) => { it('should reload the list when the sort parameter changes', (done) => {
const sort = 'desc'; const sort = 'desc';
const change = new SimpleChange(null, sort, true); const change = new SimpleChange(null, sort, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -465,18 +447,14 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ sort: change }); component.ngOnChanges({ sort: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should reload the process list when the name parameter changes', (done) => { it('should reload the process list when the name parameter changes', (done) => {
const name = 'FakeTaskName'; const name = 'FakeTaskName';
const change = new SimpleChange(null, name, true); const change = new SimpleChange(null, name, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -487,18 +465,14 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ name: change }); component.ngOnChanges({ name: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
it('should reload the list when the assignment parameter changes', (done) => { it('should reload the list when the assignment parameter changes', (done) => {
const assignment = 'assignee'; const assignment = 'assignee';
const change = new SimpleChange(null, assignment, true); const change = new SimpleChange(null, assignment, true);
spyOn(taskListService, 'findTasksByState').and.returnValue(of(transformDates(fakeGlobalTask)));
component.success.subscribe((res) => { component.success.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(component.rows).toBeDefined(); expect(component.rows).toBeDefined();
@@ -509,12 +483,6 @@ describe('TaskListComponent', () => {
}); });
component.ngOnChanges({ assignment: change }); component.ngOnChanges({ assignment: change });
jasmine.Ajax.requests.mostRecent().respondWith({
status: 200,
contentType: 'application/json',
responseText: JSON.stringify(fakeGlobalTask)
});
}); });
}); });
-492
View File
@@ -94,7 +94,6 @@
"eslint-plugin-unicorn": "^49.0.0", "eslint-plugin-unicorn": "^49.0.0",
"graphql": "^16.9.0", "graphql": "^16.9.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"jasmine-ajax": "4.0.0",
"jasmine-core": "5.13.0", "jasmine-core": "5.13.0",
"jasmine-reporters": "^2.5.2", "jasmine-reporters": "^2.5.2",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
@@ -106,12 +105,9 @@
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "5.0.1", "karma-jasmine": "5.0.1",
"karma-jasmine-ajax": "0.1.13",
"karma-jasmine-html-reporter": "^2.1.0", "karma-jasmine-html-reporter": "^2.1.0",
"karma-mocha-reporter": "2.2.5",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"lint-staged": "15.5.2", "lint-staged": "15.5.2",
"mocha": "11.7.5",
"moment": "^2.29.4", "moment": "^2.29.4",
"ng-packagr": "19.2.2", "ng-packagr": "19.2.2",
"nock": "13.5.5", "nock": "13.5.5",
@@ -15925,13 +15921,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true,
"license": "ISC"
},
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.1", "version": "4.28.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz",
@@ -18727,16 +18716,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/diff": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz",
"integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/diff-sequences": { "node_modules/diff-sequences": {
"version": "29.6.3", "version": "29.6.3",
"resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz",
@@ -23015,16 +22994,6 @@
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/is-plain-obj": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz",
"integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=8"
}
},
"node_modules/is-plain-object": { "node_modules/is-plain-object": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
@@ -23419,13 +23388,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/jasmine-ajax": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jasmine-ajax/-/jasmine-ajax-4.0.0.tgz",
"integrity": "sha512-htTxNw38BSHxxmd8RRMejocdPqLalGHU6n3HWFbzp/S8AuTQd1MYjkSH3dYDsbZ7EV1Xqx/b94m3tKaVSVBV2A==",
"dev": true,
"license": "MIT"
},
"node_modules/jasmine-core": { "node_modules/jasmine-core": {
"version": "5.13.0", "version": "5.13.0",
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-5.13.0.tgz", "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-5.13.0.tgz",
@@ -28273,26 +28235,6 @@
"karma": "^6.0.0" "karma": "^6.0.0"
} }
}, },
"node_modules/karma-jasmine-ajax": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/karma-jasmine-ajax/-/karma-jasmine-ajax-0.1.13.tgz",
"integrity": "sha512-5eKFqStB/IfODMghdJR2ryBiZt8bl6Dykjkbm6e58aIDFoaUefCzewq9EjZEiAcJ7rKQ8bivxWgbqJJ2qKZo+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"jasmine-ajax": "^3.0.0"
},
"peerDependencies": {
"karma": ">=0.12.0"
}
},
"node_modules/karma-jasmine-ajax/node_modules/jasmine-ajax": {
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/jasmine-ajax/-/jasmine-ajax-3.4.0.tgz",
"integrity": "sha512-LIVNVCmx5ou+IG6wgX7j73YYzvE2e3aqFWMjOhvAHWTnLICOYSobIH+PG/gOwtP20X0u2SkD3NXT/j5X8rMGOA==",
"dev": true,
"license": "MIT"
},
"node_modules/karma-jasmine-html-reporter": { "node_modules/karma-jasmine-html-reporter": {
"version": "2.2.0", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.2.0.tgz", "resolved": "https://registry.npmjs.org/karma-jasmine-html-reporter/-/karma-jasmine-html-reporter-2.2.0.tgz",
@@ -28312,122 +28254,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/karma-mocha-reporter": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/karma-mocha-reporter/-/karma-mocha-reporter-2.2.5.tgz",
"integrity": "sha512-Hr6nhkIp0GIJJrvzY8JFeHpQZNseuIakGac4bpw8K1+5F0tLb6l7uvXRa8mt2Z+NVwYgCct4QAfp2R2QP6o00w==",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^2.1.0",
"log-symbols": "^2.1.0",
"strip-ansi": "^4.0.0"
},
"peerDependencies": {
"karma": ">=0.13"
}
},
"node_modules/karma-mocha-reporter/node_modules/ansi-regex": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz",
"integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/karma-mocha-reporter/node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/karma-mocha-reporter/node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/karma-mocha-reporter/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/karma-mocha-reporter/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true,
"license": "MIT"
},
"node_modules/karma-mocha-reporter/node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/karma-mocha-reporter/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/karma-mocha-reporter/node_modules/strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-regex": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/karma-mocha-reporter/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/karma-source-map-support": { "node_modules/karma-source-map-support": {
"version": "1.4.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz", "resolved": "https://registry.npmjs.org/karma-source-map-support/-/karma-source-map-support-1.4.0.tgz",
@@ -29470,97 +29296,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/log-symbols": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-2.2.0.tgz",
"integrity": "sha512-VeIAFslyIerEJLXHziedo2basKbMKtTw3vfn5IzG0XTjhAVEJyNHnL2p7vc+wBDSdQuUpNw3M2u6xb9QsAY5Eg==",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^2.0.1"
},
"engines": {
"node": ">=4"
}
},
"node_modules/log-symbols/node_modules/ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-convert": "^1.9.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/log-symbols/node_modules/chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/log-symbols/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"license": "MIT",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/log-symbols/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
"dev": true,
"license": "MIT"
},
"node_modules/log-symbols/node_modules/escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/log-symbols/node_modules/has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=4"
}
},
"node_modules/log-symbols/node_modules/supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^3.0.0"
},
"engines": {
"node": ">=4"
}
},
"node_modules/log-update": { "node_modules/log-update": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz", "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz",
@@ -30144,184 +29879,6 @@
"node": ">=10" "node": ">=10"
} }
}, },
"node_modules/mocha": {
"version": "11.7.5",
"resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.5.tgz",
"integrity": "sha512-mTT6RgopEYABzXWFx+GcJ+ZQ32kp4fMf0xvpZIIfSq9Z8lC/++MtcCnQ9t5FP2veYEP95FIYSvW+U9fV4xrlig==",
"dev": true,
"license": "MIT",
"dependencies": {
"browser-stdout": "^1.3.1",
"chokidar": "^4.0.1",
"debug": "^4.3.5",
"diff": "^7.0.0",
"escape-string-regexp": "^4.0.0",
"find-up": "^5.0.0",
"glob": "^10.4.5",
"he": "^1.2.0",
"is-path-inside": "^3.0.3",
"js-yaml": "^4.1.0",
"log-symbols": "^4.1.0",
"minimatch": "^9.0.5",
"ms": "^2.1.3",
"picocolors": "^1.1.1",
"serialize-javascript": "^6.0.2",
"strip-json-comments": "^3.1.1",
"supports-color": "^8.1.1",
"workerpool": "^9.2.0",
"yargs": "^17.7.2",
"yargs-parser": "^21.1.1",
"yargs-unparser": "^2.0.0"
},
"bin": {
"_mocha": "bin/_mocha",
"mocha": "bin/mocha.js"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/mocha/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"license": "MIT",
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/mocha/node_modules/chalk/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/mocha/node_modules/find-up": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
"integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
"dev": true,
"license": "MIT",
"dependencies": {
"locate-path": "^6.0.0",
"path-exists": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mocha/node_modules/js-yaml": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
"dev": true,
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/mocha/node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
"integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-locate": "^5.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mocha/node_modules/log-symbols": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz",
"integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"chalk": "^4.1.0",
"is-unicode-supported": "^0.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mocha/node_modules/minimatch": {
"version": "9.0.9",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
"integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
"dev": true,
"license": "ISC",
"dependencies": {
"brace-expansion": "^2.0.2"
},
"engines": {
"node": ">=16 || 14 >=14.17"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/mocha/node_modules/p-locate": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
"integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
"dev": true,
"license": "MIT",
"dependencies": {
"p-limit": "^3.0.2"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/mocha/node_modules/supports-color": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
"integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/supports-color?sponsor=1"
}
},
"node_modules/moment": { "node_modules/moment": {
"version": "2.30.1", "version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
@@ -39543,13 +39100,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/workerpool": {
"version": "9.3.4",
"resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz",
"integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/wrap-ansi": { "node_modules/wrap-ansi": {
"version": "6.2.0", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
@@ -39842,48 +39392,6 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/yargs-unparser": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz",
"integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==",
"dev": true,
"license": "MIT",
"dependencies": {
"camelcase": "^6.0.0",
"decamelize": "^4.0.0",
"flat": "^5.0.2",
"is-plain-obj": "^2.1.0"
},
"engines": {
"node": ">=10"
}
},
"node_modules/yargs-unparser/node_modules/camelcase": {
"version": "6.3.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
"integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yargs-unparser/node_modules/decamelize": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz",
"integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yargs/node_modules/ansi-regex": { "node_modules/yargs/node_modules/ansi-regex": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
-4
View File
@@ -123,7 +123,6 @@
"eslint-plugin-unicorn": "^49.0.0", "eslint-plugin-unicorn": "^49.0.0",
"graphql": "^16.9.0", "graphql": "^16.9.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"jasmine-ajax": "4.0.0",
"jasmine-core": "5.13.0", "jasmine-core": "5.13.0",
"jasmine-reporters": "^2.5.2", "jasmine-reporters": "^2.5.2",
"jasmine-spec-reporter": "7.0.0", "jasmine-spec-reporter": "7.0.0",
@@ -135,12 +134,9 @@
"karma-chrome-launcher": "~3.2.0", "karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "5.0.1", "karma-jasmine": "5.0.1",
"karma-jasmine-ajax": "0.1.13",
"karma-jasmine-html-reporter": "^2.1.0", "karma-jasmine-html-reporter": "^2.1.0",
"karma-mocha-reporter": "2.2.5",
"license-checker": "^25.0.1", "license-checker": "^25.0.1",
"lint-staged": "15.5.2", "lint-staged": "15.5.2",
"mocha": "11.7.5",
"moment": "^2.29.4", "moment": "^2.29.4",
"ng-packagr": "19.2.2", "ng-packagr": "19.2.2",
"nock": "13.5.5", "nock": "13.5.5",