mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-7706] create tags return promise tag paging instead of tag entry (#10869)
* [ACS-7706] Corrected returned type for createTags function * [ACS-7706] Updated documentation for createTags and fixed unit tests
This commit is contained in:
@@ -209,9 +209,9 @@ export class TagsApi extends BaseApi {
|
||||
/**
|
||||
* Create specified by **tags** list of tags.
|
||||
* @param tags List of tags to create.
|
||||
* @returns Promise<TagEntry[]>
|
||||
* @returns Promise<TagEntry | TagPaging>
|
||||
*/
|
||||
createTags(tags: TagBody[]): Promise<TagEntry[]> {
|
||||
createTags(tags: TagBody[]): Promise<TagEntry | TagPaging> {
|
||||
throwIfNotDefined(tags, 'tags');
|
||||
|
||||
return this.post({
|
||||
|
@@ -240,7 +240,7 @@ Create specified by **tags** list of tags.
|
||||
|----------|-----------------------|-------------------------|
|
||||
| **tags** | [TagBody[]](#TagBody) | List of tags to create. |
|
||||
|
||||
**Return type**: [TagEntry[]](#TagEntry)
|
||||
**Return type**: [TagEntry](#TagEntry) | [TagPaging](#TagPaging)
|
||||
|
||||
**Example**
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import assert from 'assert';
|
||||
import { AlfrescoApi, TagBody, TagEntry, TagsApi } from '../../src';
|
||||
import { AlfrescoApi, TagBody, TagEntry, TagPaging, TagsApi } from '../../src';
|
||||
import { EcmAuthMock, TagMock } from '../mockObjects';
|
||||
|
||||
describe('Tags', () => {
|
||||
@@ -105,10 +105,10 @@ describe('Tags', () => {
|
||||
describe('createTags', () => {
|
||||
it('should return created tags', (done) => {
|
||||
tagMock.createTags201Response();
|
||||
tagsApi.createTags([new TagBody(), new TagBody()]).then((tags) => {
|
||||
assert.equal(tags.length, 2);
|
||||
assert.equal(tags[0].entry.tag, 'tag-test-1');
|
||||
assert.equal(tags[1].entry.tag, 'tag-test-2');
|
||||
tagsApi.createTags([new TagBody(), new TagBody()]).then((tags: TagPaging) => {
|
||||
assert.equal(tags.list.entries.length, 2);
|
||||
assert.equal(tags.list.entries[0].entry.tag, 'tag-test-1');
|
||||
assert.equal(tags.list.entries[1].entry.tag, 'tag-test-2');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@@ -65,7 +65,7 @@ export class TagMock extends BaseMock {
|
||||
createTags201Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/tags')
|
||||
.reply(201, [this.mockTagEntry(), this.mockTagEntry('tag-test-2', 'd79bdbd0-9f55-45bb-9521-811e15bf48f6')]);
|
||||
.reply(201, this.getPaginatedListOfTags());
|
||||
}
|
||||
|
||||
get201ResponseForAssigningTagsToNode(body: TagBody[]): void {
|
||||
|
Reference in New Issue
Block a user