@@ -20,8 +20,8 @@ describe('Checkbox, Radio & Switch components ', () => {
2020 accessibilityHint = "toggle Agree"
2121 />
2222 ) ;
23- expect ( screen . queryByTestId ( 'checkbox' ) ) . not . toBeNull ( ) ;
24- expect ( screen . queryByTestId ( 'checkbox-label' ) ) . toBeNull ( ) ;
23+ expect ( screen . getByTestId ( 'checkbox' ) ) . toBeOnTheScreen ( ) ;
24+ expect ( screen . queryByTestId ( 'checkbox-label' ) ) . not . toBeOnTheScreen ( ) ;
2525 expect (
2626 screen . getByTestId ( 'checkbox' ) . props . accessibilityState . checked
2727 ) . toBe ( false ) ;
@@ -48,7 +48,7 @@ describe('Checkbox, Radio & Switch components ', () => {
4848 accessibilityHint = "toggle Agree"
4949 />
5050 ) ;
51- expect ( screen . queryByTestId ( 'checkbox' ) ) . not . toBeNull ( ) ;
51+ expect ( screen . getByTestId ( 'checkbox' ) ) . toBeOnTheScreen ( ) ;
5252
5353 fireEvent . press ( screen . getByTestId ( 'checkbox' ) ) ;
5454 expect ( mockOnChange ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -65,8 +65,8 @@ describe('Checkbox, Radio & Switch components ', () => {
6565 label = "I agree to terms and conditions"
6666 />
6767 ) ;
68- expect ( screen . queryByTestId ( 'checkbox' ) ) . not . toBeNull ( ) ;
69- expect ( screen . queryByTestId ( 'checkbox-label' ) ) . not . toBeNull ( ) ;
68+ expect ( screen . getByTestId ( 'checkbox' ) ) . toBeOnTheScreen ( ) ;
69+ expect ( screen . getByTestId ( 'checkbox-label' ) ) . toBeOnTheScreen ( ) ;
7070 expect (
7171 screen . getByTestId ( 'checkbox' ) . props . accessibilityState . checked
7272 ) . toBe ( false ) ;
@@ -77,7 +77,7 @@ describe('Checkbox, Radio & Switch components ', () => {
7777 'agree'
7878 ) ;
7979
80- expect ( screen . queryByTestId ( 'checkbox-label' ) ?. props . children ) . toBe (
80+ expect ( screen . getByTestId ( 'checkbox-label' ) ?. props . children ) . toBe (
8181 'I agree to terms and conditions'
8282 ) ;
8383 fireEvent . press ( screen . getByTestId ( 'checkbox' ) ) ;
@@ -94,8 +94,8 @@ describe('Checkbox, Radio & Switch components ', () => {
9494 accessibilityHint = "toggle Agree"
9595 />
9696 ) ;
97- expect ( screen . queryByTestId ( 'radio' ) ) . not . toBeNull ( ) ;
98- expect ( screen . queryByTestId ( 'radio-label' ) ) . toBeNull ( ) ;
97+ expect ( screen . getByTestId ( 'radio' ) ) . toBeOnTheScreen ( ) ;
98+ expect ( screen . queryByTestId ( 'radio-label' ) ) . not . toBeOnTheScreen ( ) ;
9999
100100 expect ( screen . getByTestId ( 'radio' ) . props . accessibilityState . checked ) . toBe (
101101 false
@@ -118,9 +118,9 @@ describe('Checkbox, Radio & Switch components ', () => {
118118 accessibilityHint = "toggle Agree"
119119 />
120120 ) ;
121- expect ( screen . queryByTestId ( 'radio' ) ) . not . toBeNull ( ) ;
122- expect ( screen . queryByTestId ( 'radio-label' ) ) . not . toBeNull ( ) ;
123- expect ( screen . queryByTestId ( 'radio-label' ) ?. props . children ) . toBe (
121+ expect ( screen . getByTestId ( 'radio' ) ) . toBeOnTheScreen ( ) ;
122+ expect ( screen . getByTestId ( 'radio-label' ) ) . toBeOnTheScreen ( ) ;
123+ expect ( screen . getByTestId ( 'radio-label' ) ?. props . children ) . toBe (
124124 'I agree to terms and conditions'
125125 ) ;
126126
@@ -145,7 +145,7 @@ describe('Checkbox, Radio & Switch components ', () => {
145145 accessibilityHint = "toggle Agree"
146146 />
147147 ) ;
148- expect ( screen . queryByTestId ( 'radio' ) ) . not . toBeNull ( ) ;
148+ expect ( screen . getByTestId ( 'radio' ) ) . toBeOnTheScreen ( ) ;
149149
150150 fireEvent . press ( screen . getByTestId ( 'radio' ) ) ;
151151 expect ( mockOnChange ) . toHaveBeenCalledTimes ( 0 ) ;
@@ -161,8 +161,8 @@ describe('Checkbox, Radio & Switch components ', () => {
161161 accessibilityHint = "toggle Agree"
162162 />
163163 ) ;
164- expect ( screen . queryByTestId ( 'switch' ) ) . not . toBeNull ( ) ;
165- expect ( screen . queryByTestId ( 'switch-label' ) ) . toBeNull ( ) ;
164+ expect ( screen . getByTestId ( 'switch' ) ) . toBeOnTheScreen ( ) ;
165+ expect ( screen . queryByTestId ( 'switch-label' ) ) . not . toBeOnTheScreen ( ) ;
166166
167167 expect ( screen . getByTestId ( 'switch' ) . props . accessibilityState . checked ) . toBe (
168168 false
@@ -185,9 +185,9 @@ describe('Checkbox, Radio & Switch components ', () => {
185185 accessibilityHint = "toggle Agree"
186186 />
187187 ) ;
188- expect ( screen . queryByTestId ( 'switch' ) ) . not . toBeNull ( ) ;
189- expect ( screen . queryByTestId ( 'switch-label' ) ) . not . toBeNull ( ) ;
190- expect ( screen . queryByTestId ( 'switch-label' ) ?. props . children ) . toBe (
188+ expect ( screen . getByTestId ( 'switch' ) ) . toBeOnTheScreen ( ) ;
189+ expect ( screen . getByTestId ( 'switch-label' ) ) . toBeOnTheScreen ( ) ;
190+ expect ( screen . getByTestId ( 'switch-label' ) ?. props . children ) . toBe (
191191 'I agree to terms and conditions'
192192 ) ;
193193 expect ( screen . getByTestId ( 'switch' ) . props . accessibilityState . checked ) . toBe (
@@ -211,7 +211,7 @@ describe('Checkbox, Radio & Switch components ', () => {
211211 accessibilityHint = "toggle Agree"
212212 />
213213 ) ;
214- expect ( screen . queryByTestId ( 'switch' ) ) . not . toBeNull ( ) ;
214+ expect ( screen . getByTestId ( 'switch' ) ) . toBeOnTheScreen ( ) ;
215215 fireEvent . press ( screen . getByTestId ( 'switch' ) ) ;
216216 expect ( mockOnChange ) . toHaveBeenCalledTimes ( 0 ) ;
217217 } ) ;
0 commit comments