Merge pull request #18813 from namco1992/mengnan/fix-mygroupspicker-query

Fix the query filter in the MyGroupsPicker
This commit is contained in:
Patrik Oldsberg
2023-08-01 14:00:24 +02:00
committed by GitHub
3 changed files with 12 additions and 7 deletions
+5
View File
@@ -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],
},
});