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,15 +16,17 @@
*/
import assert from 'assert';
import { resetGlobalMockAgent } from '../mockObjects/base.mock';
import { AlfrescoApi, GsSitesApi } from '../../src';
import { EcmAuthMock, GsSitesApiMock } from '../mockObjects';
import { describe, it, beforeEach, afterEach } from 'node:test';
describe('Governance API test', () => {
let authResponseMock: EcmAuthMock;
let gsSitesApiMock: GsSitesApiMock;
let gsSitesApi: GsSitesApi;
beforeEach(() => {
beforeEach(async () => {
const hostEcm = 'https://127.0.0.1:8080';
authResponseMock = new EcmAuthMock(hostEcm);
@@ -37,14 +39,18 @@ describe('Governance API test', () => {
});
gsSitesApi = new GsSitesApi(alfrescoJsApi);
await alfrescoJsApi.login('admin', 'admin');
});
it('should getRMSite return the RM site', (done) => {
afterEach(() => {
resetGlobalMockAgent();
});
it('should getRMSite return the RM site', async () => {
gsSitesApiMock.get200Response();
gsSitesApi.getRMSite().then((data) => {
assert.equal(data.entry.description, 'Records Management Description Test');
done();
});
const data = await gsSitesApi.getRMSite();
assert.equal(data.entry.description, 'Records Management Description Test');
});
});