Skip to content

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

Fix boundary-stats spec fixtures for enforceSharedTiers (#79348)

Fraser630ccf8acc6b
diff --git a/frontend/lint/tests/module-boundaries-stats.unit.spec.js b/frontend/lint/tests/module-boundaries-stats.unit.spec.js
index 5908081c525..8f9195e9ed3 100644
--- a/frontend/lint/tests/module-boundaries-stats.unit.spec.js
+++ b/frontend/lint/tests/module-boundaries-stats.unit.spec.js
@@ -4,8 +4,14 @@ import {
getUnmoduledFolders,
} from "../module-boundaries-stats.mjs";
-function element({ type, pattern = "frontend/src/metabase/x/**", ...rest }) {
- return { type, pattern, ...rest };
+// Mirrors createElement's enforceSharedTiers default in module-boundaries.mjs.
+function element({
+ type,
+ pattern = "frontend/src/metabase/x/**",
+ enforceSharedTiers = true,
+ ...rest
+}) {
+ return { type, pattern, enforceSharedTiers, ...rest };
}
describe("getNamedModules", () => {
@@ -58,6 +64,18 @@ describe("getEnforcedModules", () => {
expect(getEnforcedModules(elements)).toEqual(new Set(["shared/nav"]));
});
+ it("excludes shared modules grandfathered out of the sub-tiers", () => {
+ const elements = [
+ element({
+ type: "shared/nav",
+ enforceOutgoing: true,
+ enforceSharedTiers: false,
+ }),
+ element({ type: "shared/palette", enforceOutgoing: true }),
+ ];
+ expect(getEnforcedModules(elements)).toEqual(new Set(["shared/palette"]));
+ });
+
it("is a subset of the named modules", () => {
const elements = [
element({ type: "shared/nav", enforceOutgoing: true }),