@@ -21,11 +21,11 @@ describe('Select component ', () => {
2121 label = "Select options"
2222 options = { options }
2323 onSelect = { onSelect }
24- testID = "test- select"
24+ testID = "select"
2525 />
2626 ) ;
27- expect ( screen . getByTestId ( 'test- select-trigger' ) ) . toBeOnTheScreen ( ) ;
28- expect ( screen . getByTestId ( 'test- select-label' ) ) . toBeOnTheScreen ( ) ;
27+ expect ( screen . getByTestId ( 'select-trigger' ) ) . toBeOnTheScreen ( ) ;
28+ expect ( screen . getByTestId ( 'select-label' ) ) . toBeOnTheScreen ( ) ;
2929 } ) ;
3030
3131 it ( 'should render the label correctly ' , ( ) => {
@@ -35,14 +35,12 @@ describe('Select component ', () => {
3535 label = "Select"
3636 options = { options }
3737 onSelect = { onSelect }
38- testID = "test- select"
38+ testID = "select"
3939 />
4040 ) ;
41- expect ( screen . getByTestId ( 'test-select-trigger' ) ) . toBeOnTheScreen ( ) ;
42- expect ( screen . getByTestId ( 'test-select-label' ) ) . toBeOnTheScreen ( ) ;
43- expect ( screen . getByTestId ( 'test-select-label' ) ?. props . children ) . toBe (
44- 'Select'
45- ) ;
41+ expect ( screen . getByTestId ( 'select-trigger' ) ) . toBeOnTheScreen ( ) ;
42+ expect ( screen . getByTestId ( 'select-label' ) ) . toBeOnTheScreen ( ) ;
43+ expect ( screen . getByTestId ( 'select-label' ) ?. props . children ) . toBe ( 'Select' ) ;
4644 } ) ;
4745
4846 it ( 'should render the error correctly ' , ( ) => {
@@ -52,13 +50,13 @@ describe('Select component ', () => {
5250 label = "Select"
5351 options = { options }
5452 onSelect = { onSelect }
55- testID = "test- select"
53+ testID = "select"
5654 error = "Please select an option"
5755 />
5856 ) ;
59- expect ( screen . getByTestId ( 'test- select-trigger' ) ) . toBeOnTheScreen ( ) ;
60- expect ( screen . getByTestId ( 'test- select-error' ) ) . toBeOnTheScreen ( ) ;
61- expect ( screen . getByTestId ( 'test- select-error' ) ?. props . children ) . toBe (
57+ expect ( screen . getByTestId ( 'select-trigger' ) ) . toBeOnTheScreen ( ) ;
58+ expect ( screen . getByTestId ( 'select-error' ) ) . toBeOnTheScreen ( ) ;
59+ expect ( screen . getByTestId ( 'select-error' ) ?. props . children ) . toBe (
6260 'Please select an option'
6361 ) ;
6462 } ) ;
@@ -68,30 +66,28 @@ describe('Select component ', () => {
6866 < Select
6967 label = "Select"
7068 options = { options }
71- testID = "test- select"
69+ testID = "select"
7270 placeholder = "Select an option"
7371 />
7472 ) ;
7573
76- const selectTrigger = screen . getByTestId ( 'test- select-trigger' ) ;
74+ const selectTrigger = screen . getByTestId ( 'select-trigger' ) ;
7775 fireEvent . press ( selectTrigger ) ;
7876
79- expect ( screen . getByTestId ( 'test- select-item-chocolate' ) ) . toBeOnTheScreen ( ) ;
80- expect ( screen . getByTestId ( 'test- select-item-strawberry' ) ) . toBeOnTheScreen ( ) ;
81- expect ( screen . getByTestId ( 'test- select-item-vanilla' ) ) . toBeOnTheScreen ( ) ;
77+ expect ( screen . getByTestId ( 'select-item-chocolate' ) ) . toBeOnTheScreen ( ) ;
78+ expect ( screen . getByTestId ( 'select-item-strawberry' ) ) . toBeOnTheScreen ( ) ;
79+ expect ( screen . getByTestId ( 'select-item-vanilla' ) ) . toBeOnTheScreen ( ) ;
8280 } ) ;
8381
8482 it ( 'should call onSelect on selecting an option' , ( ) => {
8583 const onSelect = jest . fn ( ) ;
8684
87- render (
88- < Select options = { options } onSelect = { onSelect } testID = "test-select" />
89- ) ;
85+ render ( < Select options = { options } onSelect = { onSelect } testID = "select" /> ) ;
9086
91- const optionModal = screen . getByTestId ( 'test- select-modal' ) ;
87+ const optionModal = screen . getByTestId ( 'select-modal' ) ;
9288 fireEvent ( optionModal , 'onPresent' ) ;
9389
94- const optionItem1 = screen . getByTestId ( 'test- select-item-chocolate' ) ;
90+ const optionItem1 = screen . getByTestId ( 'select-item-chocolate' ) ;
9591 fireEvent . press ( optionItem1 ) ;
9692
9793 expect ( onSelect ) . toHaveBeenCalledWith ( options [ 0 ] . value ) ;
0 commit comments