Fix the query filter in the MyGroupsPicker
The current implementation has filter `type=Group` which won't get any result from the catalog. I believe that the purpose of this component is to query `Group` kind entities: https://backstage.io/docs/features/software-catalog/descriptor-format#kind-group. Also fixed the tests to properly `await` the user events to avoid warnings like this: ``` console.error Warning: You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. at printWarning (../../../node_modules/react-dom/cjs/react-dom-test-utils.development.js:67:30) at error (../../../node_modules/react-dom/cjs/react-dom-test-utils.development.js:43:5) at onDone (../../../node_modules/react-dom/cjs/react-dom-test-utils.development.js:1034:9) at ../../../node_modules/react-dom/cjs/react-dom-test-utils.development.js:1073:13 ``` Signed-off-by: Mengnan Gong <namco1992@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Fix the get entities query in the `MyGroupsPicker` to query the `kind=Group` entities.
|
||||
@@ -129,7 +129,7 @@ describe('<MyGroupsPicker />', () => {
|
||||
|
||||
expect(catalogApi.getEntities).toHaveBeenCalledWith({
|
||||
filter: {
|
||||
type: 'Group',
|
||||
kind: 'Group',
|
||||
'relations.hasMember': ['user:default/bob'],
|
||||
},
|
||||
});
|
||||
@@ -201,8 +201,8 @@ describe('<MyGroupsPicker />', () => {
|
||||
|
||||
// Simulate user input
|
||||
const inputField = getByRole('combobox');
|
||||
userEvent.click(inputField);
|
||||
userEvent.type(inputField, 'group');
|
||||
await userEvent.click(inputField);
|
||||
await userEvent.type(inputField, 'group');
|
||||
|
||||
// Wait for the dropdown elements to appear
|
||||
await waitFor(() => {
|
||||
@@ -257,8 +257,8 @@ describe('<MyGroupsPicker />', () => {
|
||||
);
|
||||
|
||||
const inputField = getByRole('combobox');
|
||||
userEvent.click(inputField);
|
||||
userEvent.type(inputField, 'group');
|
||||
await userEvent.click(inputField);
|
||||
await userEvent.type(inputField, 'group');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(
|
||||
@@ -267,7 +267,7 @@ describe('<MyGroupsPicker />', () => {
|
||||
});
|
||||
|
||||
const option = getByRole('option', { name: 'My First Group' });
|
||||
userEvent.click(option);
|
||||
await userEvent.click(option);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(onChange).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -62,7 +62,7 @@ export const MyGroupsPicker = (props: MyGroupsPickerProps) => {
|
||||
|
||||
const { items } = await catalogApi.getEntities({
|
||||
filter: {
|
||||
type: 'Group',
|
||||
kind: 'Group',
|
||||
['relations.hasMember']: [userEntityRef],
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user