The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
cleanup unused files in frontend/test (#78232)
Chris Vandoodewaard265aa21a24be
diff --git a/frontend/test/__mocks__/aceSearchBoxExtMock.ts b/frontend/test/__mocks__/aceSearchBoxExtMock.tsdeleted file mode 100644index f053ebf7976..00000000000--- a/frontend/test/__mocks__/aceSearchBoxExtMock.ts+++ /dev/null@@ -1 +0,0 @@-module.exports = {};diff --git a/frontend/test/__support__/components/mantineSelect.ts b/frontend/test/__support__/components/mantineSelect.tsdeleted file mode 100644index 514fd9f004b..00000000000--- a/frontend/test/__support__/components/mantineSelect.ts+++ /dev/null@@ -1,35 +0,0 @@-import userEvent from "@testing-library/user-event";--import { screen, within } from "__support__/ui";--export type ViewMantineSelectOptionsParams = {- /** This function will identify the root element of the select with- * screen.findByRole("combobox") but you can also supply that root element- * via this parameter */- root?: HTMLElement;- /** If supplied, this function will find the root element of the select with- * await within(findWithinElement).findByRole("combobox") */- findWithinElement?: HTMLElement;-};--/** Clicks a Mantine <Select> component, views its options, and returns info about them */-export const viewMantineSelectOptions = async ({- findWithinElement,- root,-}: ViewMantineSelectOptionsParams = {}) => {- root ??= findWithinElement- ? await within(findWithinElement).findByRole("textbox")- : await screen.findByRole("textbox");-- await userEvent.click(root);-- const listbox = await screen.findByRole("listbox");- const optionElements = await within(listbox).findAllByRole("option");- const optionTextContents = optionElements.map((option) => option.textContent);- return {- optionElements,- optionTextContents,- // Unjustified type cast. FIXME- displayedOption: root as HTMLInputElement,- };-};diff --git a/frontend/test/__support__/components/mantineSelect.unit.spec.tsx b/frontend/test/__support__/components/mantineSelect.unit.spec.tsxdeleted file mode 100644index 64e5847aa12..00000000000--- a/frontend/test/__support__/components/mantineSelect.unit.spec.tsx+++ /dev/null@@ -1,128 +0,0 @@-import { render, screen, within } from "__support__/ui";-import { Select } from "metabase/ui";--import { viewMantineSelectOptions } from "./mantineSelect";--describe("viewMantineSelectOptions", () => {- it("fetches options from the <Select> component", async () => {- render(- <Select<"option1" | "option2" | "option3">- value="option2"- data={[- { value: "option1", label: "Option 1" },- { value: "option2", label: "Option 2" },- { value: "option3", label: "Option 3" },- ]}- />,- );- const { optionElements, optionTextContents, displayedOption } =- await viewMantineSelectOptions();-- expect(optionElements.length).toBe(3);- expect(optionElements[0]).toHaveTextContent("Option 1");- expect(optionElements[1]).toHaveTextContent("Option 2");- expect(optionElements[2]).toHaveTextContent("Option 3");- expect(optionTextContents).toEqual(["Option 1", "Option 2", "Option 3"]);- expect(displayedOption.value).toBe("Option 2");- });-- it("identifies the <Select> component within a provided element, and returns information about its options", async () => {- render(- <>- <Select<"select1-option1" | "select1-option2" | "select1-option3">- value="select1-option2"- data={[- { value: "select1-option1", label: "First Select, option 1" },- { value: "select1-option2", label: "First Select, option 2" },- { value: "select1-option3", label: "First Select, option 3" },- ]}- />- <div data-testid="second-select-container">- <Select<"select2-option1" | "select2-option2" | "select2-option3">- value="select2-option2"- data={[- {- value: "select2-option1",- label: "Second Select, option 1",- },- {- value: "select2-option2",- label: "Second Select, option 2",- },- {- value: "select2-option3",- label: "Second Select, option 3",- },- ]}- />- </div>- </>,- );- const secondSelectContainer = await screen.findByTestId(- "second-select-container",- );- const { optionElements, optionTextContents, displayedOption } =- await viewMantineSelectOptions({- findWithinElement: secondSelectContainer,- });-- expect(optionElements.length).toBe(3);- expect(optionTextContents).toContain("Second Select, option 1");- expect(optionTextContents).toContain("Second Select, option 2");- expect(optionTextContents).toContain("Second Select, option 3");- expect(displayedOption.value).toBe("Second Select, option 2");- });-- it("fetches options from the Select component with a given root element", async () => {- render(- <>- <Select<"select1-option1" | "select1-option2" | "select1-option3">- value="select1-option2"- data={[- { value: "select1-option1", label: "First Select, option 1" },- { value: "select1-option2", label: "First Select, option 2" },- { value: "select1-option3", label: "First Select, option 3" },- ]}- />- <div data-testid="second-select-container">- <Select<"select2-option1" | "select2-option2" | "select2-option3">- value="select2-option2"- data={[- {- value: "select2-option1",- label: "Second Select, option 1",- },- {- value: "select2-option2",- label: "Second Select, option 2",- },- {- value: "select2-option3",- label: "Second Select, option 3",- },- ]}- />- </div>- </>,- );- const secondSelectRoot = await within(- await screen.findByTestId("second-select-container"),- ).findByRole("textbox");- const { optionElements, optionTextContents, displayedOption } =- await viewMantineSelectOptions({- root: secondSelectRoot,- });-- expect(optionElements.length).toBe(3);- expect(optionTextContents).toContain("Second Select, option 1");- expect(optionTextContents).toContain("Second Select, option 2");- expect(optionTextContents).toContain("Second Select, option 3");- expect(displayedOption.value).toBe("Second Select, option 2");- });-- it("throws an error if the <Select> is not found", async () => {- await expect(viewMantineSelectOptions()).rejects.toThrow(- /Unable to find.*role="textbox"/,- );- });-});diff --git a/frontend/test/__support__/ui-mocks.js b/frontend/test/__support__/ui-mocks.jsdeleted file mode 100644index a381b900477..00000000000--- a/frontend/test/__support__/ui-mocks.js+++ /dev/null@@ -1,21 +0,0 @@-jest.mock("metabase/common/components/Popover");--// Replace addEventListener with a test implementation which collects all event listeners to `eventListeners` map-export const eventListeners = {};--const testAddEventListener = jest.fn((event, listener) => {- eventListeners[event] = eventListeners[event]- ? [...eventListeners[event], listener]- : [listener];-});--const testRemoveEventListener = jest.fn((event, listener) => {- eventListeners[event] = (eventListeners[event] || []).filter(- (l) => l !== listener,- );-});--global.document.addEventListener = testAddEventListener;-global.window.addEventListener = testAddEventListener;-global.document.removeEventListener = testRemoveEventListener;-global.window.removeEventListener = testRemoveEventListener;