Files
orca/src/shared/feature-tips.test.ts
T
2026-05-18 11:05:43 -07:00

39 lines
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
getCompletedFeatureTipIds,
getOrderedUnseenFeatureTips,
normalizeFeatureTipIds,
type FeatureTipId
} from './feature-tips'
describe('feature tips', () => {
it('orders new unseen tips before older unseen tips', () => {
const tips = getOrderedUnseenFeatureTips({ seenTipIds: new Set<FeatureTipId>() })
expect(tips.map((tip) => tip.id)).toEqual(['voice-dictation'])
})
it('skips tips the user has already seen', () => {
const tips = getOrderedUnseenFeatureTips({
seenTipIds: new Set<FeatureTipId>(['voice-dictation'])
})
expect(tips.map((tip) => tip.id)).toEqual([])
})
it('skips tips for features the user has already completed', () => {
const tips = getOrderedUnseenFeatureTips({
seenTipIds: new Set<FeatureTipId>(),
completedTipIds: getCompletedFeatureTipIds({ voiceDictationEnabled: true })
})
expect(tips.map((tip) => tip.id)).toEqual([])
})
it('normalizes persisted tip ids', () => {
expect(normalizeFeatureTipIds(['feature-tour', 'bogus', 'voice-dictation'])).toEqual([
'voice-dictation'
])
})
})