This repository was archived by the owner on Jun 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
mockObjects/content-services Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { expect } from 'chai' ;
2
2
import { AlfrescoApiConfig } from '../../src/alfrescoApiConfig' ;
3
3
import { AlfrescoApi } from '../../src/alfrescoApi' ;
4
- import { TagsApi } from '../../src/api/content-rest-api' ;
4
+ import { TagBody , TagEntry , TagsApi } from '../../src/api/content-rest-api' ;
5
5
import { EcmAuthMock , TagMock } from '../../test/mockObjects' ;
6
6
7
7
describe ( 'Tags' , ( ) => {
@@ -49,4 +49,20 @@ describe('Tags', () => {
49
49
}
50
50
) ;
51
51
} ) ;
52
+
53
+ describe ( 'createTags' , ( ) => {
54
+ it ( 'should return created tags' , ( done : Mocha . Done ) => {
55
+ tagMock . createTags201Response ( ) ;
56
+ tagsApi . createTags ( [ new TagBody ( ) , new TagBody ( ) ] ) . then ( ( tags : TagEntry [ ] ) => {
57
+ expect ( tags ) . length ( 2 ) ;
58
+ expect ( tags [ 0 ] . entry . tag ) . equal ( 'tag-test-1' ) ;
59
+ expect ( tags [ 1 ] . entry . tag ) . equal ( 'tag-test-2' ) ;
60
+ done ( ) ;
61
+ } ) ;
62
+ } ) ;
63
+
64
+ it ( 'should throw error if tags are not passed' , ( ) => {
65
+ expect ( tagsApi . createTags . bind ( tagsApi , null ) ) . throw ( ) ;
66
+ } ) ;
67
+ } ) ;
52
68
} ) ;
Original file line number Diff line number Diff line change @@ -43,4 +43,20 @@ export class TagMock extends BaseMock {
43
43
} ,
44
44
} ) ;
45
45
}
46
+
47
+ createTags201Response ( ) : void {
48
+ nock ( this . host , { encodedQueryParams : true } )
49
+ . post ( '/alfresco/api/-default-/public/alfresco/versions/1/tags' )
50
+ . reply ( 201 , [ {
51
+ entry : {
52
+ tag : 'tag-test-1' ,
53
+ id : '0d89aa82-f2b8-4a37-9a54-f4c5148174d6' ,
54
+ } ,
55
+ } , {
56
+ entry : {
57
+ tag : 'tag-test-2' ,
58
+ id : 'd79bdbd0-9f55-45bb-9521-811e15bf48f6' ,
59
+ } ,
60
+ } ] ) ;
61
+ }
46
62
}
You can’t perform that action at this time.
0 commit comments