@@ -5,41 +5,35 @@ import { withViewport } from '../src';
55
66import { Sizes } from '../src/interfaces/sizes' ;
77
8- const renderResult = ( { vw, vh } : Sizes ) => (
9- < >
10- < p data-testid = "vw" > { vw } </ p >
11- < p data-testid = "vh" > { vh } </ p >
12- </ >
13- ) ;
8+ const checkResult = ( { vw, vh } : Sizes ) => {
9+ expect ( vw ) . toBe ( 1024 ) ;
10+ expect ( vh ) . toBe ( 768 ) ;
11+
12+ return null ;
13+ } ;
1414
1515describe ( 'withViewport usage with functional component' , ( ) => {
1616 const FunctionalComponent = ( props : Sizes ) => {
17- return renderResult ( props ) ;
17+ return checkResult ( props ) ;
1818 } ;
1919
2020 const FunctionalComponentHOC = withViewport ( ) ( FunctionalComponent ) ;
2121
2222 it ( 'should render vw and wh values' , ( ) => {
23- const { getByTestId } = render ( < FunctionalComponentHOC /> ) ;
24-
25- expect ( getByTestId ( 'vw' ) . innerHTML ) . toBe ( '1024' ) ;
26- expect ( getByTestId ( 'vh' ) . innerHTML ) . toBe ( '768' ) ;
23+ render ( < FunctionalComponentHOC /> ) ;
2724 } ) ;
2825} ) ;
2926
3027describe ( 'withViewport usage with class component' , ( ) => {
3128 class ClassComponent extends Component < Sizes > {
3229 render ( ) {
33- return renderResult ( this . props ) ;
30+ return checkResult ( this . props ) ;
3431 }
3532 }
3633
3734 const ClassComponentHOC = withViewport ( ) ( ClassComponent ) ;
3835
3936 it ( 'should render vw and wh values' , ( ) => {
40- const { getByTestId } = render ( < ClassComponentHOC /> ) ;
41-
42- expect ( getByTestId ( 'vw' ) . innerHTML ) . toBe ( '1024' ) ;
43- expect ( getByTestId ( 'vh' ) . innerHTML ) . toBe ( '768' ) ;
37+ render ( < ClassComponentHOC /> ) ;
4438 } ) ;
4539} ) ;
0 commit comments