fix(desktop): retain cold-start budget after runtime installation
This commit is contained in:
@@ -3,6 +3,25 @@ import { describe, expect, it, vi } from 'vitest'
|
||||
import { withBootstrapAwareTimeout, withTimeout } from './with-timeout'
|
||||
|
||||
describe('withTimeout', () => {
|
||||
it('allows a full cold start when installation finishes near a deadline', async () => {
|
||||
vi.useFakeTimers()
|
||||
try {
|
||||
let active = true
|
||||
let finish!: (value: string) => void
|
||||
const connection = new Promise<string>(resolve => {
|
||||
finish = resolve
|
||||
})
|
||||
const result = withBootstrapAwareTimeout(connection, 45_000, 'timeout', async () => ({ active }))
|
||||
await vi.advanceTimersByTimeAsync(75_000)
|
||||
active = false
|
||||
await vi.advanceTimersByTimeAsync(25_000)
|
||||
finish('connected')
|
||||
await expect(result).resolves.toBe('connected')
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
|
||||
it.each([{ active: true }, { setupChoice: { active: true } }])(
|
||||
'waits beyond cold boot during setup: %j',
|
||||
async state => {
|
||||
|
||||
Reference in New Issue
Block a user