@@ -8,8 +8,7 @@ import { mergeStyles } from '@fluentui-react-native/merge-props';
88import type { Theme } from '@fluentui-react-native/theme-types' ;
99import { useSlot , withSlots } from '@fluentui-react-native/use-slot' ;
1010import { applyTokenLayers } from '@fluentui-react-native/use-tokens' ;
11- import { mount } from 'enzyme' ;
12- import toJson from 'enzyme-to-json' ;
11+ import * as renderer from 'react-test-renderer' ;
1312
1413import { compressible } from './compressible' ;
1514import { buildUseTokens } from './useTokens' ;
@@ -103,32 +102,28 @@ const Label = compressible<LabelProps, LabelTokens>((props: LabelProps, useToken
103102 } ;
104103} , useLabelTokens ) ;
105104
106- /**
107- * this wrapper solves the (so-far) inexplicable type errors from the matchers in typescript
108- */
109- function snapshotTestTree ( tree : any ) {
110- ( expect ( toJson ( tree ) ) as any ) . toMatchSnapshot ( ) ;
111- }
112-
113105describe ( 'compressible tests' , ( ) => {
114- /** first render the component with no updates */
115106 it ( 'Two labels, one with caption and one without' , ( ) => {
116- const tree = mount (
117- < View >
118- < Label headerText = "Header1" />
119- < Label headerText = "Header2" captionText = "Caption2" />
120- </ View > ,
121- ) ;
122- snapshotTestTree ( tree ) ;
107+ const tree = renderer
108+ . create (
109+ < View >
110+ < Label headerText = "Header1" />
111+ < Label headerText = "Header2" captionText = "Caption2" />
112+ </ View > ,
113+ )
114+ . toJSON ( ) ;
115+ expect ( tree ) . toMatchSnapshot ( ) ;
123116 } ) ;
124117
125118 it ( 'Two labels, one plugging in SuperHeader instead' , ( ) => {
126- const tree = mount (
127- < View >
128- < Label headerText = "Super Header" headerSlot = { SuperHeader } captionText = "Normal caption" />
129- < Label headerText = "Normal Header" captionText = "Another normal caption" />
130- </ View > ,
131- ) ;
132- snapshotTestTree ( tree ) ;
119+ const tree = renderer
120+ . create (
121+ < View >
122+ < Label headerText = "Super Header" headerSlot = { SuperHeader } captionText = "Normal caption" />
123+ < Label headerText = "Normal Header" captionText = "Another normal caption" />
124+ </ View > ,
125+ )
126+ . toJSON ( ) ;
127+ expect ( tree ) . toMatchSnapshot ( ) ;
133128 } ) ;
134129} ) ;
0 commit comments