Skip to content

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

647 B
Raw Blame
import { createMockSettingsState } from "__support__/state";
import MetabaseSettings from "metabase/utils/settings";
import type { EnterpriseSettings, Settings } from "metabase-types/api";
import { createMockSettings } from "metabase-types/api/mocks";

/**
 * This function mocks the settings also in MetabaseSettings,
 * without that, you'll get the annoying "Unknown premium feature xxx" warning.
 */
export function mockSettings(
  params: Partial<Settings | EnterpriseSettings> = {},
) {
  const settings = createMockSettings(params);
  const state = createMockSettingsState(settings);

  MetabaseSettings.setAll(settings);

  return state;
}