Skip to content

test(onboarding): Add tests for useScmRepoSearch and ScmRepoSelector#112127

Merged
jaydgoss merged 5 commits intomasterfrom
jaygoss/vdy-54-scm-onboarding-test-coverage
Apr 9, 2026
Merged

test(onboarding): Add tests for useScmRepoSearch and ScmRepoSelector#112127
jaydgoss merged 5 commits intomasterfrom
jaygoss/vdy-54-scm-onboarding-test-coverage

Conversation

@jaydgoss
Copy link
Copy Markdown
Member

@jaydgoss jaydgoss commented Apr 2, 2026

Summary

  • Add test coverage for useScmRepoSearch hook (7 tests): debounced search, API param passing, response transformation into reposByIdentifier Map and dropdownItems, selected repo disabling, error states, and search clearing
  • Add test coverage for ScmRepoSelector component (8 tests): rendering, empty state messaging, error display, search results, selected repo context, repo selection triggering downstream lookup, clearing the selected repo, and verifying the options-prepend logic does not duplicate a selected repo already in search results

These are the only two SCM onboarding components without test coverage.

Test plan

  • CI=true pnpm test static/app/views/onboarding/components/useScmRepoSearch.spec.tsx -- 7 passing
  • CI=true pnpm test static/app/views/onboarding/components/scmRepoSelector.spec.tsx -- 8 passing

Refs VDY-54

@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 2, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 2, 2026
jaydgoss added 2 commits April 2, 2026 16:09
These components had zero test coverage. The hook tests verify
debounced search, API param passing, response transformation,
selected repo disabling, error states, and search clearing. The
component tests verify rendering, empty state messaging, error
display, search results, and selected repo context.

Refs VDY-54
Update expected empty-state message to match the longer permissions
hint added in #111895, and assert accessibleOnly query param.

Refs VDY-54
@jaydgoss jaydgoss force-pushed the jaygoss/vdy-54-scm-onboarding-test-coverage branch from fa53d66 to e570868 Compare April 2, 2026 21:11
Replace hardcoded integration ID with mockIntegration.id so mock
responses stay coupled to the fixture.
…ctor

Add tests for repo selection (triggers downstream lookup), clearing
the selected repo, and verifying the options-prepend logic does not
duplicate a selected repo that already appears in search results.
Also fix sessionStorage leaking between tests and normalize
misleading isInstalled mock data in the hook test.

Refs VDY-54
@jaydgoss jaydgoss marked this pull request as ready for review April 2, 2026 21:30
@jaydgoss jaydgoss requested a review from a team as a code owner April 2, 2026 21:30

await userEvent.type(screen.getByRole('textbox'), 'get');

expect(await screen.findByText('sentry')).toBeInTheDocument();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

possible to find by accessibility role?

…ions

Query repo search result options by menuitemradio role instead of text,
following RTL query priority guidelines. This also removes the auto-sizer
div workaround comment since role queries avoid that ambiguity.
@jaydgoss jaydgoss enabled auto-merge (squash) April 9, 2026 19:47
@jaydgoss jaydgoss merged commit 878479c into master Apr 9, 2026
62 checks passed
@jaydgoss jaydgoss deleted the jaygoss/vdy-54-scm-onboarding-test-coverage branch April 9, 2026 19:54
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
…112127)

## Summary

- Add test coverage for `useScmRepoSearch` hook (7 tests): debounced
search, API param passing, response transformation into
`reposByIdentifier` Map and `dropdownItems`, selected repo disabling,
error states, and search clearing
- Add test coverage for `ScmRepoSelector` component (8 tests):
rendering, empty state messaging, error display, search results,
selected repo context, repo selection triggering downstream lookup,
clearing the selected repo, and verifying the options-prepend logic does
not duplicate a selected repo already in search results

These are the only two SCM onboarding components without test coverage.

## Test plan

- [x] `CI=true pnpm test
static/app/views/onboarding/components/useScmRepoSearch.spec.tsx` -- 7
passing
- [x] `CI=true pnpm test
static/app/views/onboarding/components/scmRepoSelector.spec.tsx` -- 8
passing

Refs VDY-54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants