Commit 0c4db3ac authored by Jure's avatar Jure

Add test for rendering children if authenticated/not authenticated

parent 0b63f62f
Pipeline #2773 passed with stage
in 1 minute and 42 seconds
......@@ -26,6 +26,7 @@ describe('<AuthenticatedComponent/>', () => {
const wrapper = makeWrapper({ pushState })
wrapper.instance().checkAuth({ isFetching: true })
expect(wrapper.find('button').length).toBe(0)
expect(pushState).not.toHaveBeenCalled()
})
......@@ -46,4 +47,11 @@ describe('<AuthenticatedComponent/>', () => {
wrapper.setProps({ isAuthenticated: false })
expect(pushState).toHaveBeenCalledWith('/login?next=blah')
})
it('renders children components when authenticated', async () => {
const pushState = jest.fn()
const wrapper = makeWrapper({ pushState, location: { pathname: 'blah' }, isFetching: false, isAuthenticated: true })
expect(wrapper.find('button').length).toBe(1)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment