All checks were successful
Nextcloud Server Tests / version-consistency (push) Successful in 38s
Nextcloud Server Tests / matrix-config (push) Successful in 33s
Nextcloud Server Tests / Nextcloud stable31 / PHP 8.2 (stable31, 8.2) (push) Successful in 18m59s
Nextcloud Server Tests / Nextcloud stable31 / PHP 8.3 (stable31, 8.3) (push) Successful in 17m21s
Nextcloud Server Tests / Nextcloud stable32 / PHP 8.2 (stable32, 8.2) (push) Successful in 17m53s
Nextcloud Server Tests / Nextcloud stable32 / PHP 8.3 (stable32, 8.3) (push) Successful in 18m31s
Nextcloud Server Tests / Nextcloud stable33 / PHP 8.2 (stable33, 8.2) (push) Successful in 22m56s
Nextcloud Server Tests / Nextcloud stable33 / PHP 8.3 (stable33, 8.3) (push) Successful in 19m17s
Nextcloud Server Tests / Nextcloud stable34 / PHP 8.2 (stable34, 8.2) (push) Successful in 24m2s
Nextcloud Server Tests / Nextcloud stable34 / PHP 8.3 (stable34, 8.3) (push) Successful in 22m38s
19 lines
1,001 B
TypeScript
19 lines
1,001 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { buildCalendarStatsRows, parseCalendarStatsMetrics } from '../src/services/calendarStats'
|
|
|
|
describe('calendarStats', () => {
|
|
it('builds elapsed and planned metrics from the loaded calendar rows', () => {
|
|
const rows = buildCalendarStatsRows([
|
|
{ total_hours: 4.25, future_hours: 1.5, events_count: 2 },
|
|
{ total_hours: 2, future_hours: 0, events_count: 1 },
|
|
], ['tracked_hours', 'planned_later', 'total_with_planned', 'event_count', 'average_event_duration'], 'Week')
|
|
|
|
expect(rows.map((row) => row.value)).toEqual(['6.3 h', '1.5 h', '7.8 h', '3', '2.1 h'])
|
|
expect(rows[2].hint).toBe('Within week')
|
|
})
|
|
|
|
it('keeps only supported metric ids and falls back to defaults', () => {
|
|
expect(parseCalendarStatsMetrics(['event_count', 'unknown', 'event_count'])).toEqual(['event_count'])
|
|
expect(parseCalendarStatsMetrics([])).toEqual(['tracked_hours', 'planned_later', 'event_count', 'average_event_duration'])
|
|
})
|
|
})
|