AAE-30882 Replace superagent (#11134)

* [AAE-30878] - Migrating from event-emitter to eventemitter3 which is ESM and commonJs compatibile

* [AAE-30878] - Using types to avoid compilation isues with the new ruels

* AAE-30878 - fixed lint issue on js-api

* AAE-30878 - reverted misplaced changes

* [AAE-30882] - migrating from superagent to axios

* AAE-30882 - Fixed unit test for js-api

* AAE-30882 - Fixed unit test for js-api

* AAE-30882 - Fixed unit test for js-api

* AAE-30882 - Improved some unit tests

* [ci:force]

* AAE-30882 - Checking why is ok locally but fails on CI

* AAE-30882 - Start fixing some unit tests - check 1

* AAE-30882 - Start fixing some unit tests - check 2

* [AAE-30882] - rebased

* [AAE-30882] - added missing import
This commit is contained in:
Vito Albano
2025-09-16 11:31:07 +01:00
committed by GitHub
parent b400757ad1
commit a347b20f20
55 changed files with 1105 additions and 863 deletions

View File

@@ -161,19 +161,17 @@ describe('Node', () => {
});
});
it('should return 404 error on initiateFolderSizeCalculation API call if nodeId is not found', (done) => {
it('should return 404 error on initiateFolderSizeCalculation API call if nodeId is not found', async () => {
nodeMock.post404NodeIdNotFound();
nodesApi.initiateFolderSizeCalculation('b4cff62a-664d-4d45-9302-98723eac1319').then(
() => {},
(err) => {
const { error } = JSON.parse(err.response.text);
assert.equal(error.statusCode, 404);
assert.equal(error.errorKey, 'framework.exception.EntityNotFound');
assert.equal(error.briefSummary, '11207522 The entity with id: b4cff62a-664d-4d45-9302-98723eac1319 was not found');
done();
}
);
try {
await nodesApi.initiateFolderSizeCalculation('b4cff62a-664d-4d45-9302-98723eac1319');
} catch (err) {
const error = err.response.data.error;
assert.equal(error.statusCode, 404);
assert.equal(error.errorKey, 'framework.exception.EntityNotFound');
assert.equal(error.briefSummary, '11207522 The entity with id: b4cff62a-664d-4d45-9302-98723eac1319 was not found');
}
});
it('should return size details on getFolderSizeInfo API call if everything is ok', (done) => {
@@ -196,7 +194,7 @@ describe('Node', () => {
nodesApi.getFolderSizeInfo('b4cff62a-664d-4d45-9302-98723eac1319', '5ade426e-8a04-4d50-9e42-6e8a041d50f3').then(
() => {},
(err) => {
const { error } = JSON.parse(err.response.text);
const error = err.response.data.error;
assert.equal(error.statusCode, 404);
assert.equal(error.errorKey, 'jobId does not exist');
assert.equal(error.briefSummary, '11207212 jobId does not exist');