restore-estimate.test.ts25 lines · main
| 1 | import { describe, expect, it } from 'vitest' |
| 2 | |
| 3 | import { |
| 4 | estimateRestoreTimeFromSizeGb, |
| 5 | getRestoreLongRunningThresholdMinutes, |
| 6 | } from './restore-estimate' |
| 7 | |
| 8 | describe('restore-estimate', () => { |
| 9 | it('keeps the existing restore interpolation', () => { |
| 10 | expect(estimateRestoreTimeFromSizeGb(0)).toBe(3) |
| 11 | expect(estimateRestoreTimeFromSizeGb(21_000)).toBeCloseTo(723, 0) |
| 12 | }) |
| 13 | |
| 14 | it('uses a 10 minute floor when size is missing or small', () => { |
| 15 | expect(getRestoreLongRunningThresholdMinutes()).toBe(10) |
| 16 | expect(getRestoreLongRunningThresholdMinutes(null)).toBe(10) |
| 17 | expect(getRestoreLongRunningThresholdMinutes(100)).toBe(10) |
| 18 | }) |
| 19 | |
| 20 | it('scales the long-running threshold for larger restores', () => { |
| 21 | expect(getRestoreLongRunningThresholdMinutes(200)).toBe(15) |
| 22 | expect(getRestoreLongRunningThresholdMinutes(500)).toBe(31) |
| 23 | expect(getRestoreLongRunningThresholdMinutes(1_000)).toBe(56) |
| 24 | }) |
| 25 | }) |