mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 07:20:08 +00:00
Update pdf-preview.test.js (#5656)
Since the original test iterates over a number of fixtures, it makes more sense to express it as parameterized test, running each scenario separately, each using the default timeout. GitOrigin-RevId: 6b87adbeb01975db1308b5241f6eccbcdb33f9de
This commit is contained in:
parent
0449e6c2a2
commit
bd8c6608c0
1 changed files with 11 additions and 9 deletions
|
@ -289,7 +289,7 @@ describe('<PdfPreview/>', function () {
|
|||
expect(fetchMock.calls()).to.have.length(3)
|
||||
})
|
||||
|
||||
it('displays an error message if there was a compile error', async function () {
|
||||
describe('displays error messages', function () {
|
||||
const compileErrorStatuses = {
|
||||
'clear-cache':
|
||||
'Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.',
|
||||
|
@ -313,17 +313,19 @@ describe('<PdfPreview/>', function () {
|
|||
}
|
||||
|
||||
for (const [status, message] of Object.entries(compileErrorStatuses)) {
|
||||
cleanup()
|
||||
fetchMock.restore()
|
||||
mockCompileError(status)
|
||||
it(`displays error message for '${status}' status`, async function () {
|
||||
cleanup()
|
||||
fetchMock.restore()
|
||||
mockCompileError(status)
|
||||
|
||||
renderWithEditorContext(<PdfPreview />, { scope })
|
||||
renderWithEditorContext(<PdfPreview />, { scope })
|
||||
|
||||
// wait for "compile on load" to finish
|
||||
await screen.findByRole('button', { name: 'Compiling…' })
|
||||
await screen.findByRole('button', { name: 'Recompile' })
|
||||
// wait for "compile on load" to finish
|
||||
await screen.findByRole('button', { name: 'Compiling…' })
|
||||
await screen.findByRole('button', { name: 'Recompile' })
|
||||
|
||||
screen.getByText(message)
|
||||
screen.getByText(message)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue