Files
supabase/apps/studio/lib/restore-estimate.test.ts
T
Ali Waseem 289accd7d4 chore: Update time from 10 to 20 minutes for pause projects fallback (#46479)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Minor update for long running state thresholds when updating project
sizes

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Increased the minimum threshold for recognizing long-running
operations from 10 to 20 minutes, reducing premature fallback behavior
and improving stability for longer tasks.

* **Tests**
* Updated test suite to validate the new 20-minute threshold across
default, missing, small, and larger restore scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-09 08:25:29 -06:00

26 lines
919 B
TypeScript

import { describe, expect, it } from 'vitest'
import {
estimateRestoreTimeFromSizeGb,
getRestoreLongRunningThresholdMinutes,
} from './restore-estimate'
describe('restore-estimate', () => {
it('keeps the existing restore interpolation', () => {
expect(estimateRestoreTimeFromSizeGb(0)).toBe(3)
expect(estimateRestoreTimeFromSizeGb(21_000)).toBeCloseTo(723, 0)
})
it('uses a 20 minute floor when size is missing or small', () => {
expect(getRestoreLongRunningThresholdMinutes()).toBe(20)
expect(getRestoreLongRunningThresholdMinutes(null)).toBe(20)
expect(getRestoreLongRunningThresholdMinutes(100)).toBe(20)
})
it('scales the long-running threshold for larger restores', () => {
expect(getRestoreLongRunningThresholdMinutes(200)).toBe(20)
expect(getRestoreLongRunningThresholdMinutes(500)).toBe(31)
expect(getRestoreLongRunningThresholdMinutes(1_000)).toBe(56)
})
})