1- import { ReactTestRendererJSON } from 'react-test-renderer' ;
21import { defaultMapProps } from '../format-default' ;
32
4- const node : ReactTestRendererJSON = {
5- type : 'View' ,
6- props : { } ,
7- children : null ,
8- } ;
9-
103describe ( 'mapPropsForQueryError' , ( ) => {
114 test ( 'preserves props that are helpful for debugging' , ( ) => {
125 const props = {
@@ -32,89 +25,79 @@ describe('mapPropsForQueryError', () => {
3225 defaultValue : 'DEFAULT_VALUE' ,
3326 } ;
3427
35- const result = defaultMapProps ( props , node ) ;
28+ const result = defaultMapProps ( props ) ;
3629 expect ( result ) . toStrictEqual ( props ) ;
3730 } ) ;
3831
3932 test ( 'does not preserve less helpful props' , ( ) => {
40- const result = defaultMapProps (
41- {
42- style : [ { flex : 1 } , { display : 'flex' } ] ,
43- onPress : ( ) => null ,
44- key : 'foo' ,
45- } ,
46- node
47- ) ;
33+ const result = defaultMapProps ( {
34+ style : [ { flex : 1 } , { flexDirection : 'row' } ] ,
35+ onPress : ( ) => null ,
36+ key : 'foo' ,
37+ } ) ;
4838
4939 expect ( result ) . toStrictEqual ( { } ) ;
5040 } ) ;
5141
52- test ( 'preserves "display: none" style but no other style' , ( ) => {
53- const result = defaultMapProps (
54- { style : [ { flex : 1 } , { display : 'none' , flex : 2 } ] } ,
55- node
56- ) ;
42+ test ( 'preserves "display" and "opacity" styles but no other style' , ( ) => {
43+ const result = defaultMapProps ( {
44+ style : [ { flex : 1 } , { display : 'none' , flex : 2 } , { opacity : 0.5 } ] ,
45+ } ) ;
5746
5847 expect ( result ) . toStrictEqual ( {
59- style : { display : 'none' } ,
48+ style : { display : 'none' , opacity : 0.5 } ,
6049 } ) ;
6150 } ) ;
6251
6352 test ( 'removes undefined keys from accessibilityState' , ( ) => {
64- const result = defaultMapProps (
65- { accessibilityState : { checked : undefined , selected : false } } ,
66- node
67- ) ;
53+ const result = defaultMapProps ( {
54+ accessibilityState : { checked : undefined , selected : false } ,
55+ } ) ;
6856
6957 expect ( result ) . toStrictEqual ( {
7058 accessibilityState : { selected : false } ,
7159 } ) ;
7260 } ) ;
7361
7462 test ( 'removes accessibilityState if all keys are undefined' , ( ) => {
75- const result = defaultMapProps (
76- { accessibilityState : { checked : undefined , selected : undefined } } ,
77- node
78- ) ;
63+ const result = defaultMapProps ( {
64+ accessibilityState : { checked : undefined , selected : undefined } ,
65+ } ) ;
7966
8067 expect ( result ) . toStrictEqual ( { } ) ;
8168 } ) ;
8269
8370 test ( 'does not fail if accessibilityState is a string, passes through' , ( ) => {
84- const result = defaultMapProps ( { accessibilityState : 'foo' } , node ) ;
71+ const result = defaultMapProps ( { accessibilityState : 'foo' } ) ;
8572 expect ( result ) . toStrictEqual ( { accessibilityState : 'foo' } ) ;
8673 } ) ;
8774
8875 test ( 'does not fail if accessibilityState is an array, passes through' , ( ) => {
89- const result = defaultMapProps ( { accessibilityState : [ 1 ] } , node ) ;
76+ const result = defaultMapProps ( { accessibilityState : [ 1 ] } ) ;
9077 expect ( result ) . toStrictEqual ( { accessibilityState : [ 1 ] } ) ;
9178 } ) ;
9279
9380 test ( 'does not fail if accessibilityState is null, passes through' , ( ) => {
94- const result = defaultMapProps ( { accessibilityState : null } , node ) ;
81+ const result = defaultMapProps ( { accessibilityState : null } ) ;
9582 expect ( result ) . toStrictEqual ( { accessibilityState : null } ) ;
9683 } ) ;
9784
9885 test ( 'does not fail if accessibilityState is nested object, passes through' , ( ) => {
9986 const accessibilityState = { 1 : { 2 : 3 } , 2 : undefined } ;
100- const result = defaultMapProps ( { accessibilityState } , node ) ;
87+ const result = defaultMapProps ( { accessibilityState } ) ;
10188 expect ( result ) . toStrictEqual ( { accessibilityState : { 1 : { 2 : 3 } } } ) ;
10289 } ) ;
10390
10491 test ( 'removes undefined keys from accessibilityValue' , ( ) => {
105- const result = defaultMapProps (
106- { accessibilityValue : { min : 1 , max : undefined } } ,
107- node
108- ) ;
92+ const result = defaultMapProps ( {
93+ accessibilityValue : { min : 1 , max : undefined } ,
94+ } ) ;
10995
11096 expect ( result ) . toStrictEqual ( { accessibilityValue : { min : 1 } } ) ;
11197 } ) ;
11298
11399 test ( 'removes accessibilityValue if all keys are undefined' , ( ) => {
114- const result = defaultMapProps (
115- { accessibilityValue : { min : undefined } } ,
116- node
117- ) ;
100+ const result = defaultMapProps ( { accessibilityValue : { min : undefined } } ) ;
118101
119102 expect ( result ) . toStrictEqual ( { } ) ;
120103 } ) ;
0 commit comments