mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
migrate js-api tests from Jest to Node.js native test runner (#12104)
This commit is contained in:
@@ -16,8 +16,10 @@
|
||||
*/
|
||||
|
||||
import assert from 'assert';
|
||||
import { resetGlobalMockAgent } from '../mockObjects/base.mock';
|
||||
import { BpmAuthMock, ProcessMock } from '../mockObjects';
|
||||
import { AlfrescoApi, ProcessDefinitionsApi, ProcessInstanceQueryRepresentation, ProcessInstancesApi } from '../../src';
|
||||
import { describe, it, beforeEach, afterEach } from 'node:test';
|
||||
|
||||
describe('Activiti Process Api', () => {
|
||||
let authResponseBpmMock: BpmAuthMock;
|
||||
@@ -45,7 +47,11 @@ describe('Activiti Process Api', () => {
|
||||
await alfrescoJsApi.login('admin', 'admin');
|
||||
});
|
||||
|
||||
it('get activiti Process list filtered', (done) => {
|
||||
afterEach(() => {
|
||||
resetGlobalMockAgent();
|
||||
});
|
||||
|
||||
it('get activiti Process list filtered', async () => {
|
||||
processMock.get200Response();
|
||||
|
||||
const requestNode: ProcessInstanceQueryRepresentation = {
|
||||
@@ -54,31 +60,25 @@ describe('Activiti Process Api', () => {
|
||||
state: 'completed'
|
||||
};
|
||||
|
||||
processInstancesApi.getProcessInstances(requestNode).then((data) => {
|
||||
assert.equal(data.data[0].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.data[1].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.size, 2);
|
||||
done();
|
||||
});
|
||||
const data = await processInstancesApi.getProcessInstances(requestNode);
|
||||
assert.equal(data.data[0].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.data[1].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.size, 2);
|
||||
});
|
||||
|
||||
it('get activiti Process list', (done) => {
|
||||
it('get activiti Process list', async () => {
|
||||
processMock.get200Response();
|
||||
|
||||
processInstancesApi.getProcessInstances({}).then((data) => {
|
||||
assert.equal(data.data[0].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.data[1].name, 'Process Test Api - July 26th 2016');
|
||||
done();
|
||||
});
|
||||
const data = await processInstancesApi.getProcessInstances({});
|
||||
assert.equal(data.data[0].name, 'Process Test Api - July 26th 2016');
|
||||
assert.equal(data.data[1].name, 'Process Test Api - July 26th 2016');
|
||||
});
|
||||
|
||||
it('get process definition startForm', (done) => {
|
||||
it('get process definition startForm', async () => {
|
||||
processMock.get200getProcessDefinitionStartForm();
|
||||
const processDefinitionId = 'testProcess:1:7504';
|
||||
|
||||
processDefinitionsApi.getProcessDefinitionStartForm(processDefinitionId).then((data) => {
|
||||
assert.equal(data.processDefinitionId, 'testProcess:1:7504');
|
||||
done();
|
||||
});
|
||||
const data = await processDefinitionsApi.getProcessDefinitionStartForm(processDefinitionId);
|
||||
assert.equal(data.processDefinitionId, 'testProcess:1:7504');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user