File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import reactDom from 'react-dom/server' ;
23import test from 'tape' ;
3- import { shallow } from 'enzyme ' ;
4+ import dom from 'cheerio ' ;
45
56import hello from 'components/hello' ;
67import createActions from 'test-fixtures/components/hello/create-actions' ;
78
89const Hello = hello ( React ) ;
10+ const render = reactDom . renderToStaticMarkup ;
911
1012test ( 'Hello' , nest => {
1113 nest . test ( '...with no parameters' , assert => {
1214 const msg = 'should render our hello greeting!' ;
1315
1416 const text = '<p>Hello, World!</p>' ;
1517 const re = new RegExp ( text , 'g' ) ;
18+
1619 const props = {
1720 actions : createActions ( )
1821 } ;
1922
20- const $ = shallow ( < Hello { ... props } /> ) ;
23+ const el = < Hello { ...props } /> ;
24+ const $ = dom . load ( render ( el ) ) ;
2125 const output = $ . html ( ) ;
2226
2327 const actual = re . test ( output ) ;
@@ -38,7 +42,9 @@ test('Hello', nest => {
3842 subject : 'React' ,
3943 actions : createActions ( )
4044 } ;
41- const $ = shallow ( < Hello { ...props } /> ) ;
45+
46+ const el = < Hello { ...props } /> ;
47+ const $ = dom . load ( render ( el ) ) ;
4248 const output = $ . html ( ) ;
4349
4450 const actual = re . test ( output ) ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import reactDom from 'react-dom/server' ;
23import test from 'tape' ;
3- import { shallow } from 'enzyme ' ;
4+ import dom from 'cheerio ' ;
45
56import createTitle from 'components/title' ;
67
78const Title = createTitle ( React ) ;
9+ const render = reactDom . renderToStaticMarkup ;
810
911test ( 'Title' , assert => {
1012 const titleText = 'Hello!' ;
@@ -13,9 +15,10 @@ test('Title', assert => {
1315 titleClass : 'title'
1416 } ;
1517 const re = new RegExp ( titleText , 'g' ) ;
16- const $ = shallow ( < Title { ...props } /> ) ;
17- const output = $ . find ( '.title' ) . html ( ) ;
1818
19+ const el = < Title { ...props } /> ;
20+ const $ = dom . load ( render ( el ) ) ;
21+ const output = $ ( '.title' ) . html ( ) ;
1922 const actual = re . test ( output ) ;
2023 const expected = true ;
2124
You can’t perform that action at this time.
0 commit comments