mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #34843 from overleaf/bg-add-compile-timer
add timer for compile with checkpoints GitOrigin-RevId: ec758d34594f242a5cac8192233bfe2db783e42a
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { expect } from 'chai'
|
||||
import PdfCompileTime from '../../../../frontend/js/features/pdf-preview/components/pdf-compile-time'
|
||||
import { DetachCompileContext } from '../../../../frontend/js/shared/context/detach-compile-context'
|
||||
|
||||
function renderComponent(compileTimeClientE2E?: number) {
|
||||
return render(
|
||||
<DetachCompileContext.Provider
|
||||
value={
|
||||
{
|
||||
compiling: false,
|
||||
deliveryLatencies: {
|
||||
compileTimeClientE2E,
|
||||
},
|
||||
} as any
|
||||
}
|
||||
>
|
||||
<PdfCompileTime />
|
||||
</DetachCompileContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
describe('<PdfCompileTime />', function () {
|
||||
it('does not render when compile duration is missing', function () {
|
||||
renderComponent(undefined)
|
||||
|
||||
expect(screen.queryByText('1.2 s')).to.not.exist
|
||||
})
|
||||
|
||||
it('renders when compile duration is available', function () {
|
||||
renderComponent(1200)
|
||||
|
||||
screen.getByText('1.2 s')
|
||||
})
|
||||
|
||||
it('renders a running timer while compiling', function () {
|
||||
render(
|
||||
<DetachCompileContext.Provider
|
||||
value={
|
||||
{
|
||||
compiling: true,
|
||||
deliveryLatencies: {},
|
||||
} as any
|
||||
}
|
||||
>
|
||||
<PdfCompileTime />
|
||||
</DetachCompileContext.Provider>
|
||||
)
|
||||
|
||||
screen.getByText('0.0 s')
|
||||
})
|
||||
})
|
||||
@@ -909,6 +909,18 @@ describe('ProjectController', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('should request compile-with-checkpoint split test assignment', async function (ctx) {
|
||||
await new Promise(resolve => {
|
||||
ctx.res.render = () => {
|
||||
expect(
|
||||
ctx.SplitTestHandler.promises.getAssignment
|
||||
).to.have.been.calledWith(ctx.req, ctx.res, 'compile-with-checkpoint')
|
||||
resolve()
|
||||
}
|
||||
ctx.ProjectController.loadEditor(ctx.req, ctx.res)
|
||||
})
|
||||
})
|
||||
|
||||
it('should redirect to domain capture page', async function (ctx) {
|
||||
ctx.Features.hasFeature.withArgs('saas').returns(true)
|
||||
ctx.SplitTestHandler.promises.getAssignment
|
||||
|
||||
Reference in New Issue
Block a user