Files
hapi/web/src/lib/sessionHeaderMobileMetadata.test.ts
T
AnanovoandGitHub 0537ddf84a feat(web): make session header metadata configurable (#1267)
* feat(web): make session header metadata configurable

* fix(web): align mobile header metadata priority
2026-08-01 23:26:17 +08:00

22 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { selectMobileSessionHeaderSecondary } from './sessionHeaderMobileMetadata'
describe('selectMobileSessionHeaderSecondary', () => {
it('follows the upstream-first display order', () => {
expect(selectMobileSessionHeaderSecondary({ machine: true, model: true, updatedAt: true })).toBe('machine')
expect(selectMobileSessionHeaderSecondary({ model: true, updatedAt: true, worktree: true })).toBe('model')
})
it('uses the next enabled and available detail when the model is absent', () => {
expect(selectMobileSessionHeaderSecondary({ machine: true, lastActive: true, updatedAt: true })).toBe('machine')
expect(selectMobileSessionHeaderSecondary({ lastActive: true, updatedAt: true })).toBe('lastActive')
expect(selectMobileSessionHeaderSecondary({ fastMode: true, updatedAt: true, createdAt: true, worktree: true })).toBe('fastMode')
expect(selectMobileSessionHeaderSecondary({ updatedAt: true, createdAt: true, worktree: true })).toBe('createdAt')
expect(selectMobileSessionHeaderSecondary({ worktree: true, fastMode: true })).toBe('fastMode')
})
it('returns no secondary detail when none are available', () => {
expect(selectMobileSessionHeaderSecondary({})).toBeNull()
})
})