mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-12332] Add checkout and cancel-checkout node support (#12133)
* [ACS-12332] Add checkout and cancel-checkout node support * [ACS-12332] cr fix
This commit is contained in:
@@ -141,6 +141,30 @@ describe('Node', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Checkout', () => {
|
||||
it('should POST to the checkout endpoint', async () => {
|
||||
nodeMock.post200CheckoutNode('fake-node-id');
|
||||
const result = await nodesApi.checkoutNode('fake-node-id');
|
||||
assert.ok(result.entry, 'cancelCheckoutNode should return a NodeEntry');
|
||||
});
|
||||
|
||||
it('should throw if nodeId is not defined', () => {
|
||||
assert.throws(() => nodesApi.checkoutNode(undefined));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Cancel Checkout', () => {
|
||||
it('should POST to the cancel-checkout endpoint', async () => {
|
||||
nodeMock.post200CancelCheckoutNode('fake-node-id');
|
||||
const result = await nodesApi.cancelCheckoutNode('fake-node-id');
|
||||
assert.ok(result.entry, 'checkoutNode should return a NodeEntry');
|
||||
});
|
||||
|
||||
it('should throw if nodeId is not defined', () => {
|
||||
assert.throws(() => nodesApi.cancelCheckoutNode(undefined));
|
||||
});
|
||||
});
|
||||
|
||||
describe('FolderInformation', () => {
|
||||
it('should return jobId on initiateFolderSizeCalculation API call if everything is ok', async () => {
|
||||
nodeMock.post200ResponseInitiateFolderSizeCalculation();
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
import { BaseMock } from '../base.mock';
|
||||
import { NodeEntry } from '../../../src';
|
||||
|
||||
export class NodeMock extends BaseMock {
|
||||
get200ResponseChildren(): void {
|
||||
@@ -284,4 +285,20 @@ export class NodeMock extends BaseMock {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
post200CheckoutNode(nodeId: string): void {
|
||||
this.mock()
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/checkout`)
|
||||
.reply(200, {
|
||||
entry: { id: 'test-node-id', name: 'Test Node' }
|
||||
} as NodeEntry);
|
||||
}
|
||||
|
||||
post200CancelCheckoutNode(nodeId: string): void {
|
||||
this.mock()
|
||||
.post(`/alfresco/api/-default-/public/alfresco/versions/1/nodes/${nodeId}/cancel-checkout`)
|
||||
.reply(200, {
|
||||
entry: { id: 'test-node-id', name: 'Test Node' }
|
||||
} as NodeEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user