@@ -29,22 +29,22 @@ describe('Mutation.bulkToggleEventMarks', () => {
2929 ( getEventsFactory as unknown as jest . Mock ) . mockReturnValue ( { bulkToggleEventMark } ) ;
3030 } ) ;
3131
32- it ( 'should throw when mark is not resolved or ignored ' , async ( ) => {
32+ it ( 'should throw when mark is not supported ' , async ( ) => {
3333 await expect (
3434 eventResolvers . Mutation . bulkToggleEventMarks (
3535 { } ,
36- { projectId : 'p1' , eventIds : [ '507f1f77bcf86cd799439012' ] , mark : 'starred ' } ,
36+ { projectId : 'p1' , eventIds : [ '507f1f77bcf86cd799439012' ] , mark : 'some-unknown-mark ' } ,
3737 ctx
3838 )
3939 ) . rejects . toThrow ( UserInputError ) ;
4040
4141 await expect (
4242 eventResolvers . Mutation . bulkToggleEventMarks (
4343 { } ,
44- { projectId : 'p1' , eventIds : [ '507f1f77bcf86cd799439012' ] , mark : 'starred ' } ,
44+ { projectId : 'p1' , eventIds : [ '507f1f77bcf86cd799439012' ] , mark : 'some-unknown-mark ' } ,
4545 ctx
4646 )
47- ) . rejects . toThrow ( 'bulkToggleEventMarks supports only resolved and ignored marks' ) ;
47+ ) . rejects . toThrow ( 'bulkToggleEventMarks supports only resolved, ignored and starred marks' ) ;
4848
4949 expect ( bulkToggleEventMark ) . not . toHaveBeenCalled ( ) ;
5050 } ) ;
@@ -84,6 +84,28 @@ describe('Mutation.bulkToggleEventMarks', () => {
8484 expect ( result ) . toEqual ( payload ) ;
8585 } ) ;
8686
87+ it ( 'should allow starred mark for bulk toggle' , async ( ) => {
88+ const payload = { updatedCount : 1 , failedEventIds : [ ] } ;
89+
90+ bulkToggleEventMark . mockResolvedValue ( payload ) ;
91+
92+ const result = await eventResolvers . Mutation . bulkToggleEventMarks (
93+ { } ,
94+ {
95+ projectId : 'p1' ,
96+ eventIds : [ '507f1f77bcf86cd799439011' ] ,
97+ mark : 'starred' ,
98+ } ,
99+ ctx
100+ ) ;
101+
102+ expect ( bulkToggleEventMark ) . toHaveBeenCalledWith (
103+ [ '507f1f77bcf86cd799439011' ] ,
104+ 'starred'
105+ ) ;
106+ expect ( result ) . toEqual ( payload ) ;
107+ } ) ;
108+
87109 it ( 'should map factory max-length error to UserInputError' , async ( ) => {
88110 bulkToggleEventMark . mockRejectedValue (
89111 new Error ( 'bulkToggleEventMark: at most 100 event ids allowed' )
0 commit comments