Skip to content

Commit c9ee8a8

Browse files
Fran McDadeFran McDade
authored andcommitted
feat: basic column filters test added (#497)
1 parent 1efbb52 commit c9ee8a8

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

jest.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/** @type {import('ts-jest').JestConfigWithTsJest} */
22
module.exports = {
3+
moduleNameMapper: {
4+
"^@storybook/addon-actions$":
5+
"<rootDir>/src/mocks/@storybook/addon-actions.ts",
6+
},
37
preset: "ts-jest/presets/js-with-ts-esm",
48
setupFiles: ["<rootDir>/tests/setup.ts"],
59
testEnvironment: "jest-environment-jsdom",
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Mock for Storybook's @storybook/addon-actions function.
3+
* The mock keeps the same function signature as the real Storybook action,
4+
* does not trigger any Storybook logic, and simply returns a Jest mock function
5+
* for use in tests.
6+
* @returns A Jest mock function.
7+
*/
8+
export const action = (): jest.Mock => jest.fn();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { matchers } from "@emotion/jest";
2+
import { composeStories } from "@storybook/react";
3+
import "@testing-library/jest-dom";
4+
import { render, screen } from "@testing-library/react";
5+
import React from "react";
6+
import * as stories from "../src/components/DataDictionary/components/Filters/stories/filters.stories";
7+
8+
expect.extend(matchers);
9+
10+
const { Default } = composeStories(stories);
11+
12+
describe("DataDictionaryColumnFilters", () => {
13+
it("renders correctly", async () => {
14+
render(<Default />);
15+
expect(await screen.findByText("Required")).toBeInTheDocument();
16+
});
17+
});

0 commit comments

Comments
 (0)