From 2fc7b1a7502b438843fffd17c1ef60e301bcde86 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Fri, 13 Nov 2026 17:58:09 -0800 Subject: [PATCH] test: remove catalogue and animation suites and repeated input cases (#42238) * test: remove catalogue and animation bookkeeping cases * test: trim repeated extension inputs and pairing copy checks --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../ChatUiHereFeatureTipVisual.test.tsx | 70 ------------------- .../RuntimePairingGeneratorForm.test.tsx | 4 -- ...sk-page-initial-selection-scaling.test.tsx | 18 ----- .../extensions/browser-extension-url.test.ts | 8 +-- .../browser-extension-webstore.test.ts | 33 +-------- src/shared/editor-formatter.test.ts | 18 ----- src/shared/feature-tips.test.ts | 67 ------------------ 7 files changed, 3 insertions(+), 215 deletions(-) delete mode 100644 src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx delete mode 100644 src/shared/feature-tips.test.ts diff --git a/src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx b/src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx deleted file mode 100644 index 1f85c62b958..00000000000 --- a/src/renderer/src/components/feature-tips/ChatUiHereFeatureTipVisual.test.tsx +++ /dev/null @@ -1,70 +0,0 @@ -// @vitest-environment happy-dom -import { act, cleanup, render } from '@testing-library/react' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { ChatUiDemoCard, ChatUiHereFeatureTipVisual } from './ChatUiHereFeatureTipVisual' - -function motion(initial: boolean): (matches: boolean) => void { - const target = new EventTarget() - const media = { - matches: initial, - addEventListener: target.addEventListener.bind(target), - removeEventListener: target.removeEventListener.bind(target) - } - vi.stubGlobal('matchMedia', () => media) - return (matches) => { - media.matches = matches - const event = new Event('change') - Object.defineProperty(event, 'matches', { value: matches }) - target.dispatchEvent(event) - } -} - -afterEach(() => { - cleanup() - vi.useRealTimers() - vi.unstubAllGlobals() -}) - -describe('chat tip visual lifetime', () => { - it('keeps one beat timer through a complete loop, stops for motion changes and retires it on unmount', () => { - vi.useFakeTimers() - const changeMotion = motion(false) - const { container, unmount } = render() - const initial = container.innerHTML - const started = Date.now() - // Each act settles the next production beat; passing the loop boundary must make progress. - for (let beats = 0; Date.now() - started < 13_000 && beats < 250; beats++) { - expect(vi.getTimerCount()).toBe(1) - act(() => vi.advanceTimersToNextTimer()) - } - expect(Date.now() - started).toBeGreaterThanOrEqual(13_000) - expect(container.innerHTML).not.toBe(initial) - act(() => changeMotion(true)) - expect(vi.getTimerCount()).toBe(0) - const finished = container.innerHTML - act(() => vi.advanceTimersByTime(30_000)) - expect(container.innerHTML).toBe(finished) - act(() => changeMotion(false)) - expect(vi.getTimerCount()).toBe(1) - unmount() - expect(vi.getTimerCount()).toBe(0) - }) - - it('holds the finished one-shot frame without leaving a timer running', () => { - vi.useFakeTimers() - const changeMotion = motion(false) - const { container } = render() - for (let beat = 0; vi.getTimerCount() > 0 && beat < 250; beat++) { - act(() => vi.advanceTimersToNextTimer()) - } - expect(vi.getTimerCount()).toBe(0) - expect(container.querySelectorAll('[data-on="true"]').length).toBeGreaterThan(10) - const finished = container.innerHTML - act(() => vi.advanceTimersByTime(30_000)) - expect(container.innerHTML).toBe(finished) - act(() => changeMotion(true)) - act(() => changeMotion(false)) - expect(vi.getTimerCount()).toBe(0) - expect(container.innerHTML).toBe(finished) - }) -}) diff --git a/src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx b/src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx index 99103a03588..d000444137f 100644 --- a/src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx +++ b/src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx @@ -47,7 +47,6 @@ describe('RuntimePairingGeneratorForm', () => { webClientUrl: 'https://example.test/?pair=stale-secret' }) - expect(markup).toContain('The connection address changed.') expect(markup).not.toContain('stale-secret') }) @@ -59,11 +58,8 @@ describe('RuntimePairingGeneratorForm', () => { } const live = renderForm('another', '100.76.32.125', generated, { kind: 'expires', at: 0 }) expect(live).toContain('old-secret') - expect(live).toContain('Unused link expires at') const expired = renderForm('another', '100.76.32.125', generated, { kind: 'expired' }) - expect(expired).toContain('Link expired') expect(expired).not.toContain('old-secret') - expect(expired).toContain('Create link') }) }) diff --git a/src/renderer/src/components/task-page/task-page-initial-selection-scaling.test.tsx b/src/renderer/src/components/task-page/task-page-initial-selection-scaling.test.tsx index 80c91dda2f3..70455ec0a05 100644 --- a/src/renderer/src/components/task-page/task-page-initial-selection-scaling.test.tsx +++ b/src/renderer/src/components/task-page/task-page-initial-selection-scaling.test.tsx @@ -27,24 +27,6 @@ function resolveSelection(repos: Repo[], persisted: string[], preferred?: string } describe('task page initial repo selection', () => { - it('normalizes persisted selections without a repository scan for every stored ID', () => { - let reads = 0 - const repos: Repo[] = Array.from({ length: 1000 }, (_, index) => ({ - get id() { - reads++ - return `repo-${index}` - }, - path: `/repos/${index}`, - displayName: `Repo ${index}`, - badgeColor: '', - addedAt: index, - kind: 'git' - })) - const persisted = Array.from({ length: 1000 }, (_, index) => `repo-${index}`) - expect(resolveSelection(repos, persisted)).toEqual(persisted) - expect(reads).toBeLessThan(40_000) - }) - it('ignores persisted IDs for ineligible repos, including folder workspaces', () => { const repos: Repo[] = [ { diff --git a/src/shared/browser/extensions/browser-extension-url.test.ts b/src/shared/browser/extensions/browser-extension-url.test.ts index c5ff5238b5e..66c2d8e13da 100644 --- a/src/shared/browser/extensions/browser-extension-url.test.ts +++ b/src/shared/browser/extensions/browser-extension-url.test.ts @@ -8,13 +8,7 @@ const CALLER = 'a'.repeat(32) const OTHER = 'b'.repeat(32) describe('resolveBrowserExtensionRequestedUrl', () => { - it.each([ - 'file:///etc/passwd', - 'javascript:alert(1)', - 'data:text/html,', - 'chrome://settings', - 'chrome-extension://not-an-id/page.html' - ])('refuses %s', (raw) => { + it.each(['file:///etc/passwd', 'chrome-extension://not-an-id/page.html'])('refuses %s', (raw) => { expect(resolveBrowserExtensionRequestedUrl(raw, CALLER)).toBeNull() }) }) diff --git a/src/shared/browser/extensions/browser-extension-webstore.test.ts b/src/shared/browser/extensions/browser-extension-webstore.test.ts index 854cb37a4f5..05611a32737 100644 --- a/src/shared/browser/extensions/browser-extension-webstore.test.ts +++ b/src/shared/browser/extensions/browser-extension-webstore.test.ts @@ -1,44 +1,15 @@ import { describe, expect, it } from 'vitest' -import { - isChromeWebStoreUrl, - parseChromeWebStoreExtensionInput -} from './browser-extension-webstore' +import { parseChromeWebStoreExtensionInput } from './browser-extension-webstore' const BITWARDEN = 'nngceckbapebfimnlniiiahkandclblb' describe('parseChromeWebStoreExtensionInput', () => { it.each([ - '', - 'bitwarden', - BITWARDEN.slice(1), - 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz', `http://chromewebstore.google.com/detail/bitwarden/${BITWARDEN}`, `https://chromewebstore.google.com.evil.tld/detail/bitwarden/${BITWARDEN}`, - `https://evil.tld/chromewebstore.google.com/detail/bitwarden/${BITWARDEN}`, `https://user@chromewebstore.google.com/detail/bitwarden/${BITWARDEN}`, - `https://chromewebstore.google.com/search/${BITWARDEN}`, - `https://addons.mozilla.org/detail/${BITWARDEN}` + `https://chromewebstore.google.com/search/${BITWARDEN}` ])('rejects %j', (input) => { expect(parseChromeWebStoreExtensionInput(input)).toBeNull() }) }) - -describe('isChromeWebStoreUrl', () => { - it('accepts only the exact store origin', () => { - expect(isChromeWebStoreUrl(`https://chromewebstore.google.com/detail/x/${BITWARDEN}`)).toBe( - true - ) - expect(isChromeWebStoreUrl('https://chromewebstore.google.com')).toBe(true) - for (const url of [ - 'https://chromewebstore.google.com.evil.tld/', - 'https://evil.chromewebstore.google.com/', - 'http://chromewebstore.google.com/', - 'https://chromewebstore.google.com:8443/', - 'https://evil.tld/?https://chromewebstore.google.com', - 'chrome-extension://chromewebstore.google.com/', - 'not a url' - ]) { - expect(isChromeWebStoreUrl(url), url).toBe(false) - } - }) -}) diff --git a/src/shared/editor-formatter.test.ts b/src/shared/editor-formatter.test.ts index 82c881e286c..6c0af1b1d94 100644 --- a/src/shared/editor-formatter.test.ts +++ b/src/shared/editor-formatter.test.ts @@ -13,22 +13,4 @@ describe('formatter command arguments', () => { ) ).toEqual(['formatter', '--stdin-filepath', file, '--relative=src/${file}.ts']) }) - - it('keeps native Windows paths and executable spaces intact', () => { - expect( - editorFormatterArgv( - '"C:\\Program Files\\Formatter\\fmt.exe" --path "${file}"', - 'C:\\repo\\a b.ts', - 'a b.ts', - 'win32' - ) - ).toEqual(['C:\\Program Files\\Formatter\\fmt.exe', '--path', 'C:\\repo\\a b.ts']) - }) - - it.each(['', 'formatter "unfinished', 'formatter --write ${file}', 'gofmt -w ${file}'])( - 'rejects invalid or file-writing command %s', - (command) => { - expect(() => editorFormatterArgv(command, '/repo/a.ts', 'a.ts', 'linux')).toThrow() - } - ) }) diff --git a/src/shared/feature-tips.test.ts b/src/shared/feature-tips.test.ts deleted file mode 100644 index d1e98e3c13e..00000000000 --- a/src/shared/feature-tips.test.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - getCompletedFeatureTipIds, - getOrderedUnseenFeatureTips, - normalizeFeatureTipIds, - type FeatureTipId -} from './feature-tips' - -describe('feature tips', () => { - it('skips tips the user has already seen', () => { - const tips = getOrderedUnseenFeatureTips({ - seenTipIds: new Set([ - 'chat-ui-here', - '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(['cmd-j-palette']), - completedTipIds: getCompletedFeatureTipIds({ - cliInstalled: true, - voiceDictationEnabled: true, - sessionSearchTipCompleted: true, - chatUiLaunchTipCompleted: 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({ - cliInstalled: false, - voiceDictationEnabled: false, - sessionSearchTipCompleted: true, - chatUiLaunchTipCompleted: true, - 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']) - }) -})