From 154c883edad56bfa58af77ab981b42c47fa68e02 Mon Sep 17 00:00:00 2001
From: Dalton <daltojohnso@users.noreply.github.com>
Date: Thu, 20 Oct 2022 14:12:33 -0400
Subject: [PATCH] Delete unused field utils (#26012)

---
 .../src/metabase/parameters/utils/fields.ts   | 20 --------
 .../parameters/utils/fields.unit.spec.ts      | 50 -------------------
 2 files changed, 70 deletions(-)
 delete mode 100644 frontend/src/metabase/parameters/utils/fields.ts
 delete mode 100644 frontend/src/metabase/parameters/utils/fields.unit.spec.ts

diff --git a/frontend/src/metabase/parameters/utils/fields.ts b/frontend/src/metabase/parameters/utils/fields.ts
deleted file mode 100644
index c5c6f431df3..00000000000
--- a/frontend/src/metabase/parameters/utils/fields.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { UiParameter } from "metabase-lib/lib/parameters/types";
-
-export function hasFieldValues(parameter: UiParameter) {
-  if ("fields" in parameter) {
-    return (
-      Array.isArray(parameter.fields) &&
-      parameter.fields.some(field => field.hasFieldValues())
-    );
-  }
-
-  return false;
-}
-
-export function hasFields(parameter: UiParameter) {
-  if ("fields" in parameter) {
-    return Array.isArray(parameter.fields) && parameter.fields.length > 0;
-  }
-
-  return false;
-}
diff --git a/frontend/src/metabase/parameters/utils/fields.unit.spec.ts b/frontend/src/metabase/parameters/utils/fields.unit.spec.ts
deleted file mode 100644
index 2add47fa5f5..00000000000
--- a/frontend/src/metabase/parameters/utils/fields.unit.spec.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { createMockUiParameter } from "metabase-lib/lib/parameters/mock";
-import Field from "metabase-lib/lib/metadata/Field";
-import { hasFieldValues, hasFields } from "./fields";
-
-describe("parameters/utils/fields", () => {
-  describe("hasFieldValues", () => {
-    const fieldWithValues = new Field({
-      values: [1, 2, 3],
-    });
-    const fieldWithoutValues = new Field();
-
-    it("should be false when the parameter has no fields", () => {
-      expect(hasFieldValues(createMockUiParameter({ fields: [] }))).toBe(false);
-    });
-
-    it("should be false when fields on the parameter have no values", () => {
-      expect(
-        hasFieldValues(createMockUiParameter({ fields: [fieldWithoutValues] })),
-      ).toBe(false);
-    });
-
-    it("should be true when a field on the parameter has values", () => {
-      expect(
-        hasFieldValues(
-          createMockUiParameter({
-            fields: [fieldWithoutValues, fieldWithValues],
-          }),
-        ),
-      ).toBe(true);
-    });
-
-    it("should handle a parameter with no fields", () => {
-      expect(hasFieldValues(createMockUiParameter())).toBe(false);
-    });
-  });
-
-  describe("hasFields", () => {
-    it("should be false when the parameter has no fields", () => {
-      expect(hasFields(createMockUiParameter({ fields: [] }))).toBe(false);
-      expect(hasFields(createMockUiParameter())).toBe(false);
-    });
-
-    it("should be true when a field on the parameter has values", () => {
-      const mockField = new Field({ id: 1, name: "foo" });
-      expect(hasFields(createMockUiParameter({ fields: [mockField] }))).toBe(
-        true,
-      );
-    });
-  });
-});
-- 
GitLab