fix(scaffolder): use id of autocompleted branches in BitbucketRepoBranchPicker

Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
Benjamin Janssens
2025-01-15 12:01:52 +01:00
parent ec1b68334d
commit 3107f1f18e
3 changed files with 7 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
Fixed a bug in the BitbucketRepoBranchPicker component that crashed the scaffolder
@@ -26,9 +26,7 @@ import userEvent from '@testing-library/user-event';
describe('BitbucketRepoBranchPicker', () => {
const scaffolderApiMock: Partial<ScaffolderApi> = {
autocomplete: jest
.fn()
.mockResolvedValue({ results: [{ title: 'branch1' }] }),
autocomplete: jest.fn().mockResolvedValue({ results: [{ id: 'branch1' }] }),
};
it('renders an input field', () => {
@@ -66,7 +66,7 @@ export const BitbucketRepoBranchPicker = ({
provider: 'bitbucket-cloud',
})
.then(({ results }) => {
setAvailableBranches(results.map(r => r.title!));
setAvailableBranches(results.map(r => r.id));
})
.catch(() => {
setAvailableBranches([]);