File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed
Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,24 @@ import Coroutine from '../src/Coroutine';
44
55describe ( 'Coroutine' , async ( ) => {
66 it ( 'should render empty body until coroutine is resolved' , async ( ) => {
7- const TestComponent = Coroutine . create ( async ( ) => < p > test</ p > ) ;
7+ const render = async ( ) => < p > test</ p > ;
8+ const TestComponent = Coroutine . create ( render ) ;
89 const tree = Renderer . create ( < TestComponent /> ) ;
9- const initial = Renderer . create ( < noscript /> ) ;
10- const success = Renderer . create ( < p > test</ p > ) ;
1110
11+ const initial = Renderer . create ( < noscript /> ) ;
1212 expect ( tree . toJSON ( ) ) . toEqual ( initial . toJSON ( ) ) ;
13- await true ;
13+
14+ const success = await Renderer . create ( < p > test</ p > ) ;
15+ expect ( tree . toJSON ( ) ) . toEqual ( success . toJSON ( ) ) ;
16+ } ) ;
17+
18+ it ( 'should pass initial information' , async ( ) => {
19+ const render = async ( { number } ) => < p > { number } </ p > ;
20+ const variables = ( ) => ( { number : 13 } ) ;
21+ const TestComponent = Coroutine . create ( render , variables ) ;
22+ const tree = Renderer . create ( < TestComponent /> ) ;
23+
24+ const success = await Renderer . create ( < p > { 13 } </ p > ) ;
1425 expect ( tree . toJSON ( ) ) . toEqual ( success . toJSON ( ) ) ;
1526 } ) ;
1627} ) ;
You can’t perform that action at this time.
0 commit comments