-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Session context and redirect on auth
- Loading branch information
1 parent
32200cd
commit 99e82eb
Showing
10 changed files
with
276 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
import React from 'react'; | ||
import { act } from 'react-dom/test-utils'; | ||
import { mountWithContexts } from '../testUtils/enzymeHelpers'; | ||
|
||
import * as SessionContext from './contexts/Session'; | ||
import App from './App'; | ||
|
||
jest.mock('./api'); | ||
|
||
describe('<App />', () => { | ||
test('renders ok', async () => { | ||
const contextValues = { | ||
setAuthRedirectTo: jest.fn(), | ||
isSessionExpired: false, | ||
}; | ||
jest | ||
.spyOn(SessionContext, 'useSession') | ||
.mockImplementation(() => contextValues); | ||
|
||
let wrapper; | ||
await act(async () => { | ||
wrapper = mountWithContexts(<App />); | ||
}); | ||
expect(wrapper.length).toBe(1); | ||
jest.clearAllMocks(); | ||
wrapper.unmount(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.