mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-12-06 07:34:00 +00:00
The confirmation for a full rescan used a fixed guess of 10 seconds per artifact. Scans now record their wall time in scan_results. The new GET /api/admin/rescan/estimate returns the artifact count of each scope and the time at the configured concurrency, from the average of recent scans. While a rescan runs, the status reports elapsed time and an ETA, and the panel shows the live rate.
31 lines
782 B
TypeScript
31 lines
782 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { formatApproxDuration, formatDuration } from './format'
|
|
|
|
describe('formatDuration', () => {
|
|
it.each([
|
|
[604800, '7 days'],
|
|
[86400, '1 day'],
|
|
[129600, '36 hours'],
|
|
[3600, '1 hour'],
|
|
[5400, '90 minutes'],
|
|
[60, '1 minute'],
|
|
])('formats %i seconds as %s', (seconds, expected) => {
|
|
expect(formatDuration(seconds)).toBe(expected)
|
|
})
|
|
})
|
|
|
|
describe('formatApproxDuration', () => {
|
|
it.each([
|
|
[0, '1 second'],
|
|
[40, '40 seconds'],
|
|
[59.4, '59 seconds'],
|
|
[60, '1 minute'],
|
|
[750, '13 minutes'],
|
|
[7199, '120 minutes'],
|
|
[7200, '2 hours'],
|
|
[36000, '10 hours'],
|
|
])('%d seconds reads %s', (seconds, expected) => {
|
|
expect(formatApproxDuration(seconds)).toBe(expected)
|
|
})
|
|
})
|