Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

ci(sdk): only setup specific enterprise plugins in sdk unit tests as needed (#66238)

Phoomparin Mano0a2255c36f55
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/EditableDashboard.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/EditableDashboard.unit.spec.tsx
index 9e82458fcce..77832919526 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/EditableDashboard.unit.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/EditableDashboard/EditableDashboard.unit.spec.tsx
@@ -98,7 +98,7 @@ describe("EditableDashboard", () => {
});
it("should allow to create a new question in addition to adding existing questions", async () => {
- await setup();
+ await setup({ hasEmbeddingEnterprisePlugin: true });
setupSimpleDataPickerEndpoints();
expect(screen.getByTestId("dashboard-header")).toBeInTheDocument();
@@ -130,9 +130,7 @@ describe("EditableDashboard", () => {
});
it("should allow to go back to the dashboard after seeing the query builder", async () => {
- await setup({
- dashboardName: "Test dashboard",
- });
+ await setup({ dashboardName: "Test dashboard" });
setupSimpleDataPickerEndpoints();
expect(screen.getByTestId("dashboard-header")).toBeInTheDocument();
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/tests/setup.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/tests/setup.tsx
index a89430117c3..b31f1c53415 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/tests/setup.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/tests/setup.tsx
@@ -1,6 +1,6 @@
import { indexBy } from "underscore";
-import { setupEnterprisePlugins } from "__support__/enterprise";
+import { setupEnterpriseOnlyPlugin } from "__support__/enterprise";
import {
setupAlertsEndpoints,
setupBookmarksEndpoints,
@@ -117,6 +117,7 @@ export interface SetupSdkDashboardOptions {
dashboardName?: string;
dataPickerProps?: EditableDashboardProps["dataPickerProps"];
dashcards?: DashboardCard[];
+ hasEmbeddingEnterprisePlugin?: boolean;
}
jest.mock("metabase/common/hooks/use-locale", () => ({
@@ -131,6 +132,7 @@ export const setupSdkDashboard = async ({
dashboardName = "Dashboard",
dataPickerProps,
dashcards = DEFAULT_DASHCARDS,
+ hasEmbeddingEnterprisePlugin = false,
}: SetupSdkDashboardOptions) => {
const useLocaleMock = useLocale as jest.Mock;
useLocaleMock.mockReturnValue({ isLocaleLoading });
@@ -198,8 +200,9 @@ export const setupSdkDashboard = async ({
}),
});
- // Used in simple data picker
- setupEnterprisePlugins();
+ if (hasEmbeddingEnterprisePlugin) {
+ setupEnterpriseOnlyPlugin("embedding");
+ }
renderWithSDKProviders(
<Box h="500px">