generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Major refactor to the Authorizations List and Details pages (#188)
- Loading branch information
1 parent
3977303
commit 92420c8
Showing
88 changed files
with
2,930 additions
and
2,495 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
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,29 +1,68 @@ | ||
import { screen } from '@testing-library/react' | ||
|
||
import App from '@/App' | ||
import { errorHandlers, mswServer } from '@/test-setup' | ||
import { render } from '@/test-utils' | ||
import { initialState } from '@/features/omrr/omrr-slice' | ||
|
||
describe('App suite', () => { | ||
test('renders the App with successful data load', async () => { | ||
render(<App />, { withStateProvider: true }) | ||
test('renders the App with idle state', () => { | ||
render(<App />, { | ||
withStateProvider: true, | ||
}) | ||
|
||
screen.getByAltText('Logo') | ||
screen.getByText('Organics Info') | ||
// Wait for dashboard to load | ||
await screen.findByText( | ||
screen.getByTitle('Loading...') | ||
}) | ||
|
||
test('renders the App with loading state', () => { | ||
render(<App />, { | ||
withStateProvider: true, | ||
initialState: { | ||
omrr: { | ||
...initialState, | ||
status: 'loading', | ||
}, | ||
}, | ||
}) | ||
|
||
screen.getByAltText('Logo') | ||
screen.getByText('Organics Info') | ||
screen.getByTitle('Loading...') | ||
}) | ||
|
||
test('renders the App with successful data load', () => { | ||
render(<App />, { | ||
withStateProvider: true, | ||
initialState: { | ||
omrr: { | ||
...initialState, | ||
status: 'succeeded', | ||
}, | ||
}, | ||
}) | ||
|
||
screen.getByAltText('Logo') | ||
screen.getByText('Organics Info') | ||
screen.getByText( | ||
'Find an authorized compost and biosolid facility in British Columbia', | ||
) | ||
}) | ||
|
||
test('renders the App with error loading data', async () => { | ||
mswServer.use(...errorHandlers) | ||
|
||
render(<App />, { withStateProvider: true }) | ||
test('renders the App with error loading data', () => { | ||
render(<App />, { | ||
withStateProvider: true, | ||
initialState: { | ||
omrr: { | ||
...initialState, | ||
status: 'failed', | ||
error: 'Error message', | ||
}, | ||
}, | ||
}) | ||
|
||
screen.getByAltText('Logo') | ||
screen.getByText('Organics Info') | ||
// Wait for error message to display | ||
await screen.findByText('Loading failed, please try again later') | ||
screen.getByText('Loading failed, please try again later') | ||
}) | ||
}) |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.