问题描述
test('Signned in > new users are redirected',() => {
const store = mockStore({ user: {loginAction} })
const redirect = mount(<Provider store={store}><Router history={history}><SignIn/></Router></Provider>)
expect(redirect.find('Redirect').at(0).props()).toHaveProperty('to','/sign-up')
})
我收到此错误,有人会帮助我吗?
解决方法
我明白了
通过将expect(wrapper.find('Redirect').at(0).props()).toHaveProperty('to','/sign-up')
重写为expect(wrapper.exists('SignIn')).toBe(true)
快乐!!! :)