migrate js-api tests from Jest to Node.js native test runner (#12104)

This commit is contained in:
Denys Vuika
2026-07-28 20:04:31 +01:00
committed by GitHub
parent c316c6b594
commit 6c8b874704
58 changed files with 2355 additions and 4978 deletions
@@ -16,7 +16,10 @@
*/
import { EcmAuthMock, FilePlansMock } from '../mockObjects';
import { resetGlobalMockAgent } from '../mockObjects/base.mock';
import { AlfrescoApi, FilePlanRolePaging, FilePlansApi } from '../../src';
import assert from 'assert';
import { describe, it, beforeEach, afterEach } from 'node:test';
describe('FilePlansApi', () => {
let filePlansApiMock: FilePlansMock;
@@ -34,6 +37,10 @@ describe('FilePlansApi', () => {
await alfrescoApi.login('admin', 'admin');
});
afterEach(() => {
resetGlobalMockAgent();
});
describe('getFilePlanRoles', () => {
const filePlanId = 'filePlanId123';
@@ -102,59 +109,45 @@ describe('FilePlansApi', () => {
};
});
it('should get file plan roles', (done) => {
it('should get file plan roles', async () => {
filePlansApiMock.get200FilePlanRoles(filePlanId);
filePlansApi.getFilePlanRoles(filePlanId).then((rolePaging) => {
expect(rolePaging).toEqual(expectedRolePaging);
done();
});
const rolePaging = await filePlansApi.getFilePlanRoles(filePlanId);
assert.deepStrictEqual(rolePaging, expectedRolePaging);
});
it('should get file plan roles with filtering by capability names', (done) => {
it('should get file plan roles with filtering by capability names', async () => {
filePlansApiMock.get200FilePlanRolesWithFilteringByCapabilityNames(filePlanId);
filePlansApi
.getFilePlanRoles(filePlanId, {
where: {
capabilityNames: ['capability1', 'capability2']
}
})
.then((rolePaging) => {
expect(rolePaging).toEqual(expectedRolePaging);
done();
});
const rolePaging = await filePlansApi.getFilePlanRoles(filePlanId, {
where: {
capabilityNames: ['capability1', 'capability2']
}
});
assert.deepStrictEqual(rolePaging, expectedRolePaging);
});
it('should get file plan roles with filtering by person id', (done) => {
it('should get file plan roles with filtering by person id', async () => {
filePlansApiMock.get200FilePlanRolesWithFilteringByPersonId(filePlanId);
filePlansApi
.getFilePlanRoles(filePlanId, {
where: {
personId: 'someUser'
}
})
.then((rolePaging) => {
expect(rolePaging).toEqual(expectedRolePaging);
done();
});
const rolePaging = await filePlansApi.getFilePlanRoles(filePlanId, {
where: {
personId: 'someUser'
}
});
assert.deepStrictEqual(rolePaging, expectedRolePaging);
});
it('should get file plan roles with filtering by capability names', (done) => {
it('should get file plan roles with filtering by capability names', async () => {
filePlansApiMock.get200FilePlanRolesWithFilteringByPersonIdAndCapabilityNames(filePlanId);
filePlansApi
.getFilePlanRoles(filePlanId, {
where: {
personId: 'someUser',
capabilityNames: ['capability1', 'capability2']
}
})
.then((rolePaging) => {
expect(rolePaging).toEqual(expectedRolePaging);
done();
});
const rolePaging = await filePlansApi.getFilePlanRoles(filePlanId, {
where: {
personId: 'someUser',
capabilityNames: ['capability1', 'capability2']
}
});
assert.deepStrictEqual(rolePaging, expectedRolePaging);
});
});
});