@@ -113,6 +113,7 @@ describe('CasesParamsFields renders', () => {
113113 expect ( await screen . findByTestId ( 'time-window-unit-select' ) ) . toBeInTheDocument ( ) ;
114114 expect ( await screen . findByTestId ( 'create-case-template-select' ) ) . toBeInTheDocument ( ) ;
115115 expect ( await screen . findByTestId ( 'reopen-case' ) ) . toBeInTheDocument ( ) ;
116+ expect ( await screen . findByTestId ( 'maximum-case-to-open-input' ) ) . toBeInTheDocument ( ) ;
116117 } ) ;
117118
118119 it ( 'renders loading state of grouping by fields correctly' , async ( ) => {
@@ -167,6 +168,22 @@ describe('CasesParamsFields renders', () => {
167168 expect ( await screen . findByText ( 'error' ) ) . toBeInTheDocument ( ) ;
168169 } ) ;
169170
171+ it ( 'renders the default maximum amount of cases correctly' , async ( ) => {
172+ render ( < CasesParamsFields { ...defaultProps } /> ) ;
173+
174+ const maximumCasesInput = await screen . findByTestId ( 'maximum-case-to-open-input' ) ;
175+ expect ( maximumCasesInput ) . toHaveValue ( 5 ) ;
176+
177+ // set to the maximum
178+ fireEvent . change ( maximumCasesInput , { target : { value : '20' } } ) ;
179+ expect ( editAction . mock . calls [ 0 ] [ 1 ] . maximumCasesToOpen ) . toEqual ( 20 ) ;
180+ expect ( maximumCasesInput ) . toBeValid ( ) ;
181+
182+ // set to an invalid value
183+ fireEvent . change ( maximumCasesInput , { target : { value : '22' } } ) ;
184+ expect ( maximumCasesInput ) . toBeInvalid ( ) ;
185+ } ) ;
186+
170187 describe ( 'UI updates' , ( ) => {
171188 it ( 'renders grouping by field options' , async ( ) => {
172189 render ( < CasesParamsFields { ...defaultProps } /> ) ;
0 commit comments