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() }) expect(tips.map((tip) => tip.id)).toEqual(['voice-dictation']) }) it('skips tips the user has already seen', () => { const tips = getOrderedUnseenFeatureTips({ seenTipIds: new Set(['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(), completedTipIds: getCompletedFeatureTipIds({ voiceDictationEnabled: true }) }) expect(tips.map((tip) => tip.id)).toEqual([]) }) it('skips tips for features the user has already interacted with', () => { const tips = getOrderedUnseenFeatureTips({ seenTipIds: new Set(), completedTipIds: getCompletedFeatureTipIds({ voiceDictationEnabled: false, featureInteractions: { 'voice-dictation': { firstInteractedAt: 100, interactionCount: 1 } } }) }) expect(tips.map((tip) => tip.id)).toEqual([]) }) it('normalizes persisted tip ids', () => { expect(normalizeFeatureTipIds(['feature-tour', 'bogus', 'voice-dictation'])).toEqual([ 'voice-dictation' ]) }) })