From 4fb69fdaf6fb91cf3b36b10925f8cf63a0a8da06 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Tue, 28 Nov 2023 13:59:49 +0100 Subject: [PATCH] frontend-plugin-api: update ExtensionBoundary test + switch to extensionId Signed-off-by: Patrik Oldsberg --- .../src/components/ExtensionBoundary.test.tsx | 15 +++++++++------ .../src/components/ExtensionBoundary.tsx | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx b/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx index fbef6dab45..669335d577 100644 --- a/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx +++ b/packages/frontend-plugin-api/src/components/ExtensionBoundary.test.tsx @@ -83,15 +83,18 @@ describe('ExtensionBoundary', () => { ), ).render(); - await waitFor(() => - expect(analyticsApiMock.getEvents()[0]).toMatchObject({ + await waitFor(() => { + const event = analyticsApiMock + .getEvents() + .find(e => e.subject === subject); + + expect(event).toMatchObject({ action, subject, context: { - extension: 'test', - routeRef: 'unknown', + extensionId: 'test', }, - }), - ); + }); + }); }); }); diff --git a/packages/frontend-plugin-api/src/components/ExtensionBoundary.tsx b/packages/frontend-plugin-api/src/components/ExtensionBoundary.tsx index c9fa75c7fa..623c875837 100644 --- a/packages/frontend-plugin-api/src/components/ExtensionBoundary.tsx +++ b/packages/frontend-plugin-api/src/components/ExtensionBoundary.tsx @@ -59,7 +59,7 @@ export function ExtensionBoundary(props: ExtensionBoundaryProps) { // Skipping "routeRef" attribute in the new system, the extension "id" should provide more insight const attributes = { - extension: node.spec.id, + extensionId: node.spec.id, pluginId: node.spec.source?.id, };