From 5f1debd316e02ecb0b9bfea513131384ea5a0c34 Mon Sep 17 00:00:00 2001 From: Matthew Runyon Date: Tue, 17 Oct 2023 17:42:22 -0500 Subject: [PATCH] Improve test --- .../src/WidgetLoaderPlugin.test.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/dashboard-core-plugins/src/WidgetLoaderPlugin.test.tsx b/packages/dashboard-core-plugins/src/WidgetLoaderPlugin.test.tsx index 5871fcd52e..45c66d7a59 100644 --- a/packages/dashboard-core-plugins/src/WidgetLoaderPlugin.test.tsx +++ b/packages/dashboard-core-plugins/src/WidgetLoaderPlugin.test.tsx @@ -200,7 +200,13 @@ describe('WidgetLoaderPlugin', () => { it('Overrides plugins that handle the same widget type', async () => { const layoutManager = createAndMountDashboard([ - ['test-widget-plugin', testWidgetPlugin], + [ + 'test-widget-plugin', + { + ...testWidgetPlugin, + supportedTypes: ['test-widget', 'test-widget-a'], + }, + ], [ 'test-widget-plugin-two', { @@ -224,9 +230,10 @@ describe('WidgetLoaderPlugin', () => { act( () => layoutManager?.eventHub.emit(PanelEvent.OPEN, { - widget: { type: 'test-widget-two' }, + widget: { type: 'test-widget-a' }, }) ); + expect(screen.queryAllByText('TestWidget').length).toBe(1); expect(screen.queryAllByText('TestWidgetTwo').length).toBe(1); }); });