@@ -105,7 +105,57 @@ describe('sections API validation', () => {
105105 executeSectionsSetPageNumbering ( adapter , {
106106 target : { kind : 'section' , sectionId : 'section-0' } ,
107107 } ) ,
108- ) . toThrow ( / r e q u i r e s a t l e a s t o n e o f s t a r t o r f o r m a t / i) ;
108+ ) . toThrow ( / r e q u i r e s a t l e a s t o n e o f s t a r t , f o r m a t , c h a p t e r S t y l e , o r c h a p t e r S e p a r a t o r / i) ;
109+ } ) ;
110+
111+ it ( 'accepts chapterStyle for setPageNumbering' , ( ) => {
112+ const setPageNumbering = mock ( makeAdapter ( ) . setPageNumbering ) ;
113+ const adapter = makeAdapter ( { setPageNumbering } ) ;
114+
115+ executeSectionsSetPageNumbering ( adapter , {
116+ target : { kind : 'section' , sectionId : 'section-0' } ,
117+ chapterStyle : 1 ,
118+ } ) ;
119+
120+ expect ( setPageNumbering ) . toHaveBeenCalledWith (
121+ { target : { kind : 'section' , sectionId : 'section-0' } , chapterStyle : 1 } ,
122+ { changeMode : 'direct' , dryRun : false , expectedRevision : undefined } ,
123+ ) ;
124+ } ) ;
125+
126+ it ( 'accepts valid chapterSeparator for setPageNumbering' , ( ) => {
127+ const setPageNumbering = mock ( makeAdapter ( ) . setPageNumbering ) ;
128+ const adapter = makeAdapter ( { setPageNumbering } ) ;
129+
130+ executeSectionsSetPageNumbering ( adapter , {
131+ target : { kind : 'section' , sectionId : 'section-0' } ,
132+ chapterSeparator : 'enDash' ,
133+ } ) ;
134+
135+ expect ( setPageNumbering ) . toHaveBeenCalledWith (
136+ { target : { kind : 'section' , sectionId : 'section-0' } , chapterSeparator : 'enDash' } ,
137+ { changeMode : 'direct' , dryRun : false , expectedRevision : undefined } ,
138+ ) ;
139+ } ) ;
140+
141+ it ( 'rejects invalid chapterSeparator for setPageNumbering' , ( ) => {
142+ const adapter = makeAdapter ( ) ;
143+ expect ( ( ) =>
144+ executeSectionsSetPageNumbering ( adapter , {
145+ target : { kind : 'section' , sectionId : 'section-0' } ,
146+ chapterSeparator : 'slash' as any ,
147+ } ) ,
148+ ) . toThrow ( / c h a p t e r S e p a r a t o r / i) ;
149+ } ) ;
150+
151+ it ( 'rejects chapterStyle less than 1 for setPageNumbering' , ( ) => {
152+ const adapter = makeAdapter ( ) ;
153+ expect ( ( ) =>
154+ executeSectionsSetPageNumbering ( adapter , {
155+ target : { kind : 'section' , sectionId : 'section-0' } ,
156+ chapterStyle : 0 ,
157+ } ) ,
158+ ) . toThrow ( / c h a p t e r S t y l e / i) ;
109159 } ) ;
110160
111161 it ( 'requires at least one field for setPageBorders' , ( ) => {
0 commit comments