Add test case

Signed-off-by: Matthias Lindinger <matthias.lindinger@bsb-muenchen.de>
This commit is contained in:
Matthias Lindinger
2026-03-10 08:18:30 +01:00
parent 864a7993b2
commit a6b90538ef
@@ -176,5 +176,42 @@ describe('GitlabRepoPicker', () => {
expect(onChange).toHaveBeenCalledWith({ owner: 'my-mock-owner' });
});
it('should render description if allowed owners are passed', async () => {
const { findByText } = await renderInTestApp(
<TestApiProvider apis={[[scaffolderApiRef, scaffolderApiMock]]}>
<GitlabRepoPicker
onChange={jest.fn()}
rawErrors={[]}
state={{ repoName: 'repo' }}
allowedOwners={['owner1']}
/>
</TestApiProvider>,
);
expect(
await findByText(
/GitLab namespace where this repository will belong to./,
),
).toBeInTheDocument();
});
it('should render description if no allowed owners are passed', async () => {
const { findByText } = await renderInTestApp(
<TestApiProvider apis={[[scaffolderApiRef, scaffolderApiMock]]}>
<GitlabRepoPicker
onChange={jest.fn()}
rawErrors={[]}
state={{ repoName: 'repo' }}
/>
</TestApiProvider>,
);
expect(
await findByText(
/GitLab namespace where this repository will belong to./,
),
).toBeInTheDocument();
});
});
});