test: clean up tests

Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
Benjamin Janssens
2024-06-16 12:02:23 +02:00
parent 2aa81ad13a
commit 025f23f013
2 changed files with 5 additions and 2 deletions
@@ -189,6 +189,7 @@ describe('BitbucketRepoPicker', () => {
describe('autocompletion', () => {
it('should populate workspaces if host is set and accessToken is provided', async () => {
const onChange = jest.fn();
const { getAllByRole, getByText } = render(
<TestApiProvider apis={[[scaffolderApiRef, scaffolderApiMock]]}>
<BitbucketRepoPicker
@@ -218,6 +219,7 @@ describe('BitbucketRepoPicker', () => {
it('should populate projects if host and workspace are set and accessToken is provided', async () => {
const onChange = jest.fn();
const { getAllByRole, getByText } = render(
<TestApiProvider apis={[[scaffolderApiRef, scaffolderApiMock]]}>
<BitbucketRepoPicker
@@ -245,6 +247,7 @@ describe('BitbucketRepoPicker', () => {
it('should populate repositories if host, workspace and project are set and accessToken is provided', async () => {
const onChange = jest.fn();
render(
<TestApiProvider apis={[[scaffolderApiRef, scaffolderApiMock]]}>
<BitbucketRepoPicker
@@ -103,7 +103,7 @@ describe('RepoUrlPickerRepoName', () => {
}
// Verify that selecting an option calls onChange
await userEvent.click(getByText('foo'));
expect(onChange).toHaveBeenCalledWith('foo');
await userEvent.click(getByText(availableRepos[0]));
expect(onChange).toHaveBeenCalledWith(availableRepos[0]);
});
});