Add namespace check as well.

Signed-off-by: Aramis Sennyey <sennyeya@amazon.com>
This commit is contained in:
Aramis Sennyey
2023-02-22 12:00:09 -05:00
committed by Fredrik Adelöw
parent 3555c2741e
commit 436b4f50bb
@@ -57,6 +57,15 @@ const ownerEntities: Entity[] = [
title: 'Another Owner',
},
},
{
apiVersion: '1',
kind: 'Group',
metadata: {
namespace: 'test-namespace',
name: 'another-owner-2',
title: 'Another Owner in Another Namespace',
},
},
];
const sampleEntities: Entity[] = [
@@ -88,6 +97,10 @@ const sampleEntities: Entity[] = [
type: 'ownedBy',
targetRef: 'group:default/another-owner',
},
{
type: 'ownedBy',
targetRef: 'group:test-namespace/another-owner-2',
},
],
},
{
@@ -134,7 +147,12 @@ describe('<EntityOwnerPicker/>', () => {
expect(screen.getByText('Owner')).toBeInTheDocument();
fireEvent.click(screen.getByTestId('owner-picker-expand'));
['Another Owner', 'some-owner', 'Some Owner 2'].forEach(owner => {
[
'Another Owner',
'some-owner',
'Some Owner 2',
'Another Owner in Another Namespace',
].forEach(owner => {
expect(screen.getByText(owner)).toBeInTheDocument();
});
});
@@ -155,6 +173,7 @@ describe('<EntityOwnerPicker/>', () => {
expect(screen.getAllByRole('option').map(o => o.textContent)).toEqual([
'Another Owner',
'Another Owner in Another Namespace',
'some-owner',
'Some Owner 2',
]);