1
1
import expect from 'expect' ;
2
2
import React from 'react' ;
3
- import { createLocation } from 'history' ;
4
- import Router from '../Router' ;
5
- import Link from '../Link' ;
3
+ import createHistory from 'history/lib/createMemoryHistory' ;
4
+ import createLocation from 'history/lib/createLocation' ;
5
+ import RoutingContext from '../RoutingContext' ;
6
+ import useRoutes from '../useRoutes' ;
6
7
7
- describe . skip ( 'server rendering' , function ( ) {
8
+ describe ( 'server rendering' , function ( ) {
8
9
var Dashboard , DashboardRoute , routes ;
9
10
beforeEach ( function ( ) {
10
11
Dashboard = React . createClass ( {
@@ -28,11 +29,16 @@ describe.skip('server rendering', function () {
28
29
} ) ;
29
30
30
31
it ( 'works' , function ( done ) {
32
+ var history = useRoutes ( createHistory ) ( { routes } ) ;
31
33
var location = createLocation ( '/' ) ;
32
34
33
- Router . run ( routes , location , function ( error , state ) {
34
- var string = React . renderToString ( < Router initialState = { state } /> ) ;
35
+ history . match ( location , function ( error , state ) {
36
+ var string = React . renderToString (
37
+ < RoutingContext history = { history } { ...state } />
38
+ ) ;
39
+
35
40
expect ( string ) . toMatch ( / T h e D a s h b o a r d / ) ;
41
+
36
42
done ( ) ;
37
43
} ) ;
38
44
} ) ;
0 commit comments