add extra test case

Signed-off-by: Mark Dunphy <markd@spotify.com>
This commit is contained in:
Mark Dunphy
2025-05-01 13:48:54 -04:00
parent 2768e8a8e3
commit af9f453c5f
@@ -77,7 +77,7 @@ describe('EntityContextMenuItemBlueprint', () => {
`);
});
it('should filter items based on the filter function', async () => {
it('should exclude items based on the filter function', async () => {
const extension = EntityContextMenuItemBlueprint.make({
name: 'test',
params: {
@@ -107,6 +107,36 @@ describe('EntityContextMenuItemBlueprint', () => {
});
});
it('should include items based on the filter function', async () => {
const extension = EntityContextMenuItemBlueprint.make({
name: 'test',
params: {
icon: <span>Icon</span>,
filter: e => e.kind.toLowerCase() === 'component',
useProps: () => ({
title: 'Test',
onClick: () => {},
}),
},
});
renderInTestApp(
<EntityProvider
entity={{
apiVersion: 'v1',
kind: 'Component',
metadata: { name: 'test' },
}}
>
<ul>{createExtensionTester(extension).reactElement()}</ul>
</EntityProvider>,
);
await waitFor(() => {
expect(screen.getByText('Test')).toBeInTheDocument();
});
});
it('should render a menu item', async () => {
const extension = EntityContextMenuItemBlueprint.make({
name: 'test',