File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ import expect from 'expect' ;
2
+ import React , { render } from 'react' ;
3
+ import MemoryHistory from '../MemoryHistory' ;
4
+ import Router from '../Router' ;
5
+ import Route from '../Route' ;
6
+ import Redirect from '../Redirect' ;
7
+
8
+ describe ( 'A <Redirect>' , function ( ) {
9
+ var node ;
10
+ beforeEach ( function ( ) {
11
+ node = document . createElement ( 'div' ) ;
12
+ } ) ;
13
+
14
+ afterEach ( function ( ) {
15
+ React . unmountComponentAtNode ( node ) ;
16
+ } ) ;
17
+
18
+ it ( 'works' , function ( done ) {
19
+ render ( (
20
+ < Router history = { new MemoryHistory ( '/notes/5' ) } >
21
+ < Route path = "messages/:id" />
22
+ < Redirect from = "notes/:id" to = "/messages/:id" />
23
+ </ Router >
24
+ ) , node , function ( ) {
25
+ expect ( this . state . location . pathname ) . toEqual ( '/messages/5' ) ;
26
+ done ( ) ;
27
+ } ) ;
28
+ } ) ;
29
+ } ) ;
You can’t perform that action at this time.
0 commit comments