All checks were successful
Nextcloud Server Tests / version-consistency (push) Successful in 50s
Nextcloud Server Tests / matrix-config (push) Successful in 39s
Nextcloud Server Tests / Nextcloud stable31 / PHP 8.2 (stable31, 8.2) (push) Successful in 19m40s
Nextcloud Server Tests / Nextcloud stable31 / PHP 8.3 (stable31, 8.3) (push) Successful in 20m4s
Nextcloud Server Tests / Nextcloud stable32 / PHP 8.2 (stable32, 8.2) (push) Successful in 19m20s
Nextcloud Server Tests / Nextcloud stable32 / PHP 8.3 (stable32, 8.3) (push) Successful in 16m58s
Nextcloud Server Tests / Nextcloud stable33 / PHP 8.2 (stable33, 8.2) (push) Successful in 18m46s
Nextcloud Server Tests / Nextcloud stable33 / PHP 8.3 (stable33, 8.3) (push) Successful in 19m37s
Nextcloud Server Tests / Nextcloud stable34 / PHP 8.2 (stable34, 8.2) (push) Successful in 18m21s
Nextcloud Server Tests / Nextcloud stable34 / PHP 8.3 (stable34, 8.3) (push) Successful in 19m13s
53 lines
2.4 KiB
TypeScript
53 lines
2.4 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
|
|
import { createDefaultWidgetTabs } from '../src/services/widgetsRegistry'
|
|
|
|
describe('widget defaults', () => {
|
|
it('keeps workspace widgets out of the standard overview', () => {
|
|
const tabs = createDefaultWidgetTabs('standard')
|
|
|
|
expect(tabs.tabs).toHaveLength(1)
|
|
expect(tabs.tabs[0].widgets.some((widget) => widget.type === 'deck_stats')).toBe(false)
|
|
})
|
|
|
|
it('uses the supplied Pro Workspace layout for Deck and Calendar stats', () => {
|
|
const tabs = createDefaultWidgetTabs('pro')
|
|
const overviewTab = tabs.tabs.find((tab) => tab.label === 'Overview')
|
|
const workspaceTab = tabs.tabs.find((tab) => tab.label === 'Workspace')
|
|
|
|
expect(workspaceTab).toBeTruthy()
|
|
expect(overviewTab?.widgets.some((widget) => widget.type === 'deck_stats')).toBe(false)
|
|
expect(workspaceTab?.widgets.map((widget) => widget.type)).toEqual([
|
|
'deck_stats',
|
|
'deck_cards',
|
|
'calendar_stats',
|
|
])
|
|
expect(workspaceTab?.widgets[2].layout).toEqual({ width: 'quarter', height: 'xl', order: 99 })
|
|
})
|
|
|
|
it('uses a focused Standard template for each goal strategy', () => {
|
|
const singleGoal = createDefaultWidgetTabs('standard', 'total_only')
|
|
const calendarGoals = createDefaultWidgetTabs('standard', 'total_plus_categories')
|
|
const fullGoals = createDefaultWidgetTabs('standard', 'full_granular')
|
|
|
|
const types = (tabs: typeof singleGoal) => tabs.tabs.flatMap((tab) => tab.widgets.map((widget) => widget.type))
|
|
|
|
expect(types(singleGoal)).toEqual(['targets_v2', 'time_summary_overview', 'dayoff_trend'])
|
|
expect(types(calendarGoals)).toContain('calendar_table')
|
|
expect(types(calendarGoals)).toHaveLength(6)
|
|
expect(types(calendarGoals)).not.toContain('balance_index')
|
|
expect(types(calendarGoals)).not.toContain('category_mix_trend')
|
|
expect(types(fullGoals)).not.toContain('deck_stats')
|
|
expect(types(fullGoals)).not.toContain('deck_cards')
|
|
expect(types(fullGoals)).toContain('balance_index')
|
|
expect(types(fullGoals)).toContain('category_mix_trend')
|
|
})
|
|
|
|
it('aligns strategy-owned widget options when creating defaults for calendar goals', () => {
|
|
const tabs = createDefaultWidgetTabs('pro', 'total_plus_categories')
|
|
const overview = tabs.tabs.flatMap((tab) => tab.widgets).find((widget) => widget.type === 'time_summary_overview')
|
|
|
|
expect(overview?.options?.defaultView ?? 'auto').toBe('auto')
|
|
expect(overview?.options?.showWeekMiniChart).not.toBe(false)
|
|
})
|
|
})
|