11import React from 'react' ;
22import { Text , View } from 'react-native' ;
33
4- import { render } from '../../' ;
5- import { prettyPrint } from '../pretty-print' ;
4+ import { render , prettyPrint , toJSON } from '../../' ;
65
76test ( 'it prints correctly with no children' , ( ) => {
8- const { testRenderer } = render ( < View /> ) ;
7+ const { container } = render ( < View /> ) ;
98
10- expect ( prettyPrint ( testRenderer . toJSON ( ) ) ) . toMatchInlineSnapshot ( `"[36m<View />[39m"` ) ;
9+ expect ( prettyPrint ( toJSON ( container ) ) ) . toMatchInlineSnapshot ( `"[36m<View />[39m"` ) ;
1110} ) ;
1211
1312test ( 'it prints correctly with one child' , ( ) => {
14- const { testRenderer } = render (
13+ const { container } = render (
1514 < View >
1615 < Text > Hello World!</ Text >
1716 </ View > ,
1817 ) ;
1918
20- expect ( prettyPrint ( testRenderer . toJSON ( ) ) ) . toMatchInlineSnapshot ( `
19+ expect ( prettyPrint ( toJSON ( container ) ) ) . toMatchInlineSnapshot ( `
2120"[36m<View>[39m
2221 [36m<Text>[39m
2322 [0mHello World![0m
@@ -27,14 +26,14 @@ test('it prints correctly with one child', () => {
2726} ) ;
2827
2928test ( 'it prints correctly with multiple children' , ( ) => {
30- const { testRenderer } = render (
29+ const { container } = render (
3130 < View >
3231 < Text > Hello</ Text >
3332 < Text > World!</ Text >
3433 </ View > ,
3534 ) ;
3635
37- expect ( prettyPrint ( testRenderer . toJSON ( ) ) ) . toMatchInlineSnapshot ( `
36+ expect ( prettyPrint ( toJSON ( container ) ) ) . toMatchInlineSnapshot ( `
3837"[36m<View>[39m
3938 [36m<Text>[39m
4039 [0mHello[0m
@@ -47,11 +46,11 @@ test('it prints correctly with multiple children', () => {
4746} ) ;
4847
4948test ( 'it supports truncating the output length' , ( ) => {
50- const { testRenderer } = render (
49+ const { container } = render (
5150 < View >
5251 < Text > Hello World!</ Text >
5352 </ View > ,
5453 ) ;
5554
56- expect ( prettyPrint ( testRenderer . toJSON ( ) , 5 ) ) . toMatch ( / \. \. \. / ) ;
55+ expect ( prettyPrint ( toJSON ( container ) , 5 ) ) . toMatch ( / \. \. \. / ) ;
5756} ) ;
0 commit comments