From 025f23f01343b66f85e439fc684546f9abf2cc2f Mon Sep 17 00:00:00 2001 From: Benjamin Janssens Date: Sun, 16 Jun 2024 12:02:23 +0200 Subject: [PATCH] test: clean up tests Signed-off-by: Benjamin Janssens --- .../fields/RepoUrlPicker/BitbucketRepoPicker.test.tsx | 3 +++ .../fields/RepoUrlPicker/RepoUrlPickerRepoName.test.tsx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.test.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.test.tsx index eb8c1f3a2c..18ce8d2c76 100644 --- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.test.tsx +++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/BitbucketRepoPicker.test.tsx @@ -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( { it('should populate projects if host and workspace are set and accessToken is provided', async () => { const onChange = jest.fn(); + const { getAllByRole, getByText } = render( { it('should populate repositories if host, workspace and project are set and accessToken is provided', async () => { const onChange = jest.fn(); + render( { } // 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]); }); });