Skip to content

Commit

Permalink
verify loading in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Conner Bryan committed May 3, 2016
1 parent 7124532 commit c8820a7
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/UserAuthWrapper-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,18 @@ const UserIsOnlyMcDuderson = UserAuthWrapper({
predicate: user => user.lastName === 'McDuderson'
})

class LoadingComponent extends Component {
render() {
return (
<div>Loading!</div>
)
}
}

const AlwaysAuthenticating = UserAuthWrapper({
authSelector: userSelector,
authenticatingSelector: () => true,
LoadingComponent: LoadingComponent,
redirectAction: routerActions.replace,
wrapperDisplayName: 'AlwaysAuthenticating'
})
Expand Down Expand Up @@ -183,6 +192,17 @@ describe('UserAuthWrapper', () => {
expect(store.getState().routing.locationBeforeTransitions.search).to.equal('')
})

it('renders the specified component when authenticating', () => {
const { history, store, tree } = setupTest()

history.push('/alwaysAuth')

const comp = findRenderedComponentWithType(tree, LoadingComponent)
// Props from React-Router
expect(comp.props.location.pathname).to.equal('/alwaysAuth')

});

it('preserves query params on redirect', () => {
const { history, store } = setupTest()

Expand Down

0 comments on commit c8820a7

Please sign in to comment.