Files
orca/src/shared/feature-tips.test.ts
T
Neil 6607c54984 perf(ci): cut redundant tests and reuse expensive setup (#28669)
* perf(ci): reduce test overhead and reuse expensive build work

* test(ci): keep worker startup outside failure-case deadlines

* test: isolate push fixture advisory locks

* test(ci): preserve fixed drain retry allowance

* Align CI contracts with current triggers and guide content

* Stabilize consolidated reveal scenarios and retain behavioral CI contracts

* Fix upstream lint blockers while retaining behavior and assertions

* Classify global Jira preferences in the WSL migration inventory

* Align Jira test fixtures with startup and build safety checks

* Include package-test routing dependency in CI checkouts and fixtures

* Keep native stream classes intact in transcript dependency tests
2026-10-14 16:14:27 -07:00

112 lines
3.2 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([
'native-chat-upgrade',
'agent-session-search',
'orca-cli',
'cmd-j-palette',
'voice-dictation'
])
})
it('treats the native chat upgrade tip as done for every profile outside its audience', () => {
const base = {
cliInstalled: true,
voiceDictationEnabled: true,
sessionSearchTipCompleted: true
}
expect(
getCompletedFeatureTipIds({ ...base, inNativeChatUpgradeTipAudience: false }).has(
'native-chat-upgrade'
)
).toBe(true)
expect(
getCompletedFeatureTipIds({ ...base, inNativeChatUpgradeTipAudience: true }).has(
'native-chat-upgrade'
)
).toBe(false)
})
it('skips tips the user has already seen', () => {
const tips = getOrderedUnseenFeatureTips({
seenTipIds: new Set<FeatureTipId>([
'native-chat-upgrade',
'voice-dictation',
'orca-cli',
'cmd-j-palette',
'agent-session-search'
])
})
expect(tips.map((tip) => tip.id)).toEqual([])
})
it('skips tips for features the user has already completed', () => {
const tips = getOrderedUnseenFeatureTips({
// cmd-j is a seen-based tip with no feature completion, so mark it seen here.
seenTipIds: new Set<FeatureTipId>(['cmd-j-palette']),
completedTipIds: getCompletedFeatureTipIds({
cliInstalled: true,
voiceDictationEnabled: true,
sessionSearchTipCompleted: true,
inNativeChatUpgradeTipAudience: false
})
})
expect(tips.map((tip) => tip.id)).toEqual([])
})
it('skips the CLI tip when the CLI is already installed', () => {
const tips = getOrderedUnseenFeatureTips({
seenTipIds: new Set<FeatureTipId>(['voice-dictation', 'cmd-j-palette']),
completedTipIds: getCompletedFeatureTipIds({
cliInstalled: true,
voiceDictationEnabled: false,
sessionSearchTipCompleted: true,
inNativeChatUpgradeTipAudience: false
})
})
expect(tips.map((tip) => tip.id)).toEqual([])
})
it('skips tips for features the user has already interacted with', () => {
const tips = getOrderedUnseenFeatureTips({
seenTipIds: new Set<FeatureTipId>(),
completedTipIds: getCompletedFeatureTipIds({
cliInstalled: false,
voiceDictationEnabled: false,
sessionSearchTipCompleted: true,
inNativeChatUpgradeTipAudience: false,
featureInteractions: {
'voice-dictation': { firstInteractedAt: 100, interactionCount: 1 }
}
})
})
expect(tips.map((tip) => tip.id)).toEqual(['orca-cli', 'cmd-j-palette'])
})
it('normalizes persisted tip ids', () => {
expect(
normalizeFeatureTipIds([
'feature-tour',
'orca-cli',
'bogus',
'cmd-j-palette',
'voice-dictation'
])
).toEqual(['orca-cli', 'cmd-j-palette', 'voice-dictation'])
})
})