restore-estimate.test.ts 919 B

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