Files
archy/neode-ui/src/views/goals/__tests__/goalStepActions.test.ts
T

40 lines
1.5 KiB
TypeScript
Raw Normal View History

2026-08-12 10:55:50 +00:00
import { describe, expect, it } from 'vitest'
import { GOALS } from '@/data/goals'
import { goalStepTargetPath } from '../goalStepActions'
import type { GoalStep } from '@/types/goals'
describe('goalStepActions', () => {
it('routes app-backed steps to their app details page', () => {
expect(goalStepTargetPath(step({ id: 'configure-filebrowser', appId: 'filebrowser' }))).toBe('/dashboard/apps/filebrowser')
})
it('routes built-in identity and backup steps to their owning screens', () => {
expect(goalStepTargetPath(step({ id: 'setup-nostr' }))).toBe('/dashboard/web5')
expect(goalStepTargetPath(step({ id: 'export-identity' }))).toBe('/dashboard/web5/credentials')
expect(goalStepTargetPath(step({ id: 'create-passphrase' }))).toBe('/dashboard/settings')
})
it('keeps passive info steps without a target route', () => {
expect(goalStepTargetPath(step({ id: 'sync-setup' }))).toBeNull()
})
it('gives every configure step in the shipped goals a destination', () => {
const configureSteps = GOALS.flatMap((goal) => goal.steps.filter((candidate) => candidate.action === 'configure'))
expect(configureSteps.map((candidate) => [candidate.id, goalStepTargetPath(candidate)])).toEqual(
configureSteps.map((candidate) => [candidate.id, expect.any(String)]),
)
})
})
function step(overrides: Partial<GoalStep>): GoalStep {
return {
id: 'step',
title: 'Step',
description: '',
action: 'configure',
isAutomatic: false,
...overrides,
}
}