[MNT-24575] Added APIS and models folder information dialog (#10460)

* [MNT-24575] Added APIs folder information

* [MNT-24575] Added models

* [MNT-24575] Added constructors to model

* [MNT-24575] Added documentation

* [MNT-24575] Added documentation

* [MNT-24575] Addressed Code review comments

* [MNT-24575] Added unit tests. Fixed typo

* [MNT-24575] Fixed accesibility issue in DialogComponent. Fixed typo in enum

* [MNT-24575] Fixed typo, incorrect ACS version, and incorrect imports

* [MNT-24575] Added unit tests to js-api

* Empty commit to trigger GHA

* [ci:force] Empty force commit to trigger GHA

* [MNT-24575] Fixed linting issue

* [MNT-24575] Removed redundant *

* [ci:force] Empty force commit to trigger GHA
This commit is contained in:
swapnil-verma-gl
2025-01-07 15:21:44 +05:30
committed by GitHub
parent 2a1691836e
commit 4787470707
13 changed files with 503 additions and 2 deletions

View File

@@ -150,4 +150,59 @@ describe('Node', () => {
);
});
});
describe('FolderInformation', () => {
it('should return jobId on initiateFolderSizeCalculation API call if everything is ok', (done) => {
nodeMock.post200ResponseInitiateFolderSizeCalculation();
nodesApi.initiateFolderSizeCalculation('b4cff62a-664d-4d45-9302-98723eac1319').then((response) => {
assert.equal(response.entry.jobId, '5ade426e-8a04-4d50-9e42-6e8a041d50f3');
done();
});
});
it('should return 404 error on initiateFolderSizeCalculation API call if nodeId is not found', (done) => {
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();
}
);
});
it('should return size details on getFolderSizeInfo API call if everything is ok', (done) => {
nodeMock.get200ResponseGetFolderSizeInfo();
nodesApi.getFolderSizeInfo('b4cff62a-664d-4d45-9302-98723eac1319', '5ade426e-8a04-4d50-9e42-6e8a041d50f3').then((response) => {
assert.equal(response.entry.id, '32e522f1-1f28-4ea3-a522-f11f284ea397');
assert.equal(response.entry.jobId, '5ade426e-8a04-4d50-9e42-6e8a041d50f3');
assert.equal(response.entry.sizeInBytes, 2689);
assert.equal(response.entry.numberOfFiles, 100);
assert.equal(response.entry.calculatedAt, '2024-12-20T12:02:23.989+0000');
assert.equal(response.entry.status, 'COMPLETED');
done();
});
});
it('should return 404 error on getFolderSizeInfo API call if jobId is not found', (done) => {
nodeMock.get404JobIdNotFound();
nodesApi.getFolderSizeInfo('b4cff62a-664d-4d45-9302-98723eac1319', '5ade426e-8a04-4d50-9e42-6e8a041d50f3').then(
() => {},
(err) => {
const { error } = JSON.parse(err.response.text);
assert.equal(error.statusCode, 404);
assert.equal(error.errorKey, 'jobId does not exist');
assert.equal(error.briefSummary, '11207212 jobId does not exist');
done();
}
);
});
});
});

View File

@@ -230,4 +230,63 @@ export class NodeMock extends BaseMock {
}
});
}
post200ResponseInitiateFolderSizeCalculation(): void {
nock(this.host, { encodedQueryParams: true })
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/size-details')
.reply(200, {
entry: {
jobId: '5ade426e-8a04-4d50-9e42-6e8a041d50f3'
}
});
}
post404NodeIdNotFound(): void {
nock(this.host, { encodedQueryParams: true })
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/size-details')
.reply(404, {
error: {
errorKey: 'framework.exception.EntityNotFound',
statusCode: 404,
briefSummary: '11207522 The entity with id: b4cff62a-664d-4d45-9302-98723eac1319 was not found',
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions',
descriptionURL: 'https://api-explorer.alfresco.com',
logId: 'fafaf3c9-4e23-412b-baf3-c94e23912be5'
}
});
}
get200ResponseGetFolderSizeInfo(): void {
nock(this.host, { encodedQueryParams: true })
.get(
'/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/size-details/5ade426e-8a04-4d50-9e42-6e8a041d50f3'
)
.reply(200, {
entry: {
numberOfFiles: 100,
jobId: '5ade426e-8a04-4d50-9e42-6e8a041d50f3',
sizeInBytes: 2689,
id: '32e522f1-1f28-4ea3-a522-f11f284ea397',
calculatedAt: '2024-12-20T12:02:23.989+0000',
status: 'COMPLETED'
}
});
}
get404JobIdNotFound(): void {
nock(this.host, { encodedQueryParams: true })
.get(
'/alfresco/api/-default-/public/alfresco/versions/1/nodes/b4cff62a-664d-4d45-9302-98723eac1319/size-details/5ade426e-8a04-4d50-9e42-6e8a041d50f3'
)
.reply(404, {
error: {
errorKey: 'jobId does not exist',
statusCode: 404,
briefSummary: '11207212 jobId does not exist',
stackTrace: 'For security reasons the stack trace is no longer displayed, but the property is kept for previous versions',
descriptionURL: 'https://api-explorer.alfresco.com',
logId: 'a98180c0-b1c0-48cb-8180-c0b1c0f8cba8'
}
});
}
}