diff --git a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt.js b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt.js
index cd1e53dd78..a1941aed29 100644
--- a/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt.js
+++ b/services/web/frontend/js/features/pdf-preview/components/timeout-upgrade-prompt.js
@@ -11,7 +11,7 @@ function TimeoutUpgradePrompt() {
const { hasPremiumCompile, isProjectOwner } = useEditorContext()
if (!window.ExposedSettings.enableSubscriptions || hasPremiumCompile) {
- return
+ return null
}
return (
diff --git a/services/web/test/frontend/features/pdf-preview/components/pdf-preview.test.js b/services/web/test/frontend/features/pdf-preview/components/pdf-preview.test.js
index 1d2f8a60af..842d73369e 100644
--- a/services/web/test/frontend/features/pdf-preview/components/pdf-preview.test.js
+++ b/services/web/test/frontend/features/pdf-preview/components/pdf-preview.test.js
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import sinon from 'sinon'
import fetchMock from 'fetch-mock'
-import { screen, fireEvent, waitFor } from '@testing-library/react'
+import { screen, fireEvent, waitFor, cleanup } from '@testing-library/react'
import PdfPreview from '../../../../../frontend/js/features/pdf-preview/components/pdf-preview'
import { renderWithEditorContext } from '../../../helpers/render-with-context'
@@ -255,20 +255,41 @@ describe('', function () {
})
it('displays an error message if there was a compile error', async function () {
- mockCompileError('compile-in-progress')
+ const compileErrorStatuses = {
+ 'clear-cache':
+ 'Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.',
+ 'clsi-maintenance':
+ 'The compile servers are down for maintenance, and will be back shortly.',
+ 'compile-in-progress':
+ 'A previous compile is still running. Please wait a minute and try compiling again.',
+ exited: 'Server Error',
+ failure: 'No PDF',
+ generic: 'Server Error',
+ 'project-too-large': 'Project too large',
+ 'rate-limited': 'Compile rate limit hit',
+ terminated: 'Compilation cancelled',
+ timedout: 'Timed out',
+ 'too-recently-compiled':
+ 'This project was compiled very recently, so this compile has been skipped.',
+ unavailable:
+ 'Sorry, the compile server for your project was temporarily unavailable. Please try again in a few moments.',
+ foo:
+ 'Sorry, something went wrong and your project could not be compiled. Please try again in a few moments.',
+ }
- renderWithEditorContext(, { scope })
+ for (const [status, message] of Object.entries(compileErrorStatuses)) {
+ cleanup()
+ fetchMock.restore()
+ mockCompileError(status)
- // wait for "compile on load" to finish
- await screen.findByRole('button', { name: 'Compiling…' })
- await screen.findByRole('button', { name: 'Recompile' })
+ renderWithEditorContext(, { scope })
- screen.getByText(
- 'Please wait for your other compile to finish before trying again.'
- )
+ // wait for "compile on load" to finish
+ await screen.findByRole('button', { name: 'Compiling…' })
+ await screen.findByRole('button', { name: 'Recompile' })
- expect(fetchMock.called('express:/project/:projectId/compile')).to.be.true // TODO: auto_compile query param
- expect(fetchMock.called('express:/build/:file')).to.be.false // TODO: actual path
+ screen.getByText(message)
+ }
})
it('displays expandable raw logs', async function () {