forked from remix-run/react-router
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverRendering-test.js
More file actions
39 lines (34 loc) · 868 Bytes
/
serverRendering-test.js
File metadata and controls
39 lines (34 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import expect from 'expect';
import React from 'react';
import { createLocation } from 'history';
import Router from '../Router';
import Link from '../Link';
describe('server rendering', function () {
var Dashboard, DashboardRoute, routes;
beforeEach(function () {
Dashboard = React.createClass({
render() {
return (
<div className="Dashboard">
<h1>The Dashboard</h1>
</div>
);
}
});
DashboardRoute = {
path: '/',
component: Dashboard
};
routes = [
DashboardRoute
];
});
it('works', function (done) {
var location = createLocation('/');
Router.run(routes, location, function (error, state) {
var string = React.renderToString(<Router initialState={state} />);
expect(string).toMatch(/The Dashboard/);
done();
});
});
});