File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/** @type {import('ts-jest').JestConfigWithTsJest } */
22module . 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" ,
Original file line number Diff line number Diff line change 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 ( ) ;
Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments