test(onboarding): Add tests for useScmRepoSearch and ScmRepoSelector#112127
Merged
test(onboarding): Add tests for useScmRepoSearch and ScmRepoSelector#112127
Conversation
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
fa53d66 to
e570868
Compare
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
Abdkhan14
approved these changes
Apr 9, 2026
|
|
||
| await userEvent.type(screen.getByRole('textbox'), 'get'); | ||
|
|
||
| expect(await screen.findByText('sentry')).toBeInTheDocument(); |
Member
There was a problem hiding this comment.
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.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useScmRepoSearchhook (7 tests): debounced search, API param passing, response transformation intoreposByIdentifierMap anddropdownItems, selected repo disabling, error states, and search clearingScmRepoSelectorcomponent (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 resultsThese 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 passingCI=true pnpm test static/app/views/onboarding/components/scmRepoSelector.spec.tsx-- 8 passingRefs VDY-54