2019-06-19 14:40:52 +00:00
|
|
|
import createGenerateClassName from "@material-ui/core/styles/createGenerateClassName";
|
|
|
|
import initStoryshots from "@storybook/addon-storyshots";
|
|
|
|
// tslint:disable no-submodule-imports
|
|
|
|
import * as generateRandomKey from "draft-js/lib/generateRandomKey";
|
|
|
|
import { configure, render } from "enzyme";
|
|
|
|
import * as Adapter from "enzyme-adapter-react-16";
|
|
|
|
import toJSON from "enzyme-to-json";
|
|
|
|
|
|
|
|
configure({ adapter: new Adapter() });
|
|
|
|
|
|
|
|
jest.mock("@material-ui/core/styles/createGenerateClassName");
|
|
|
|
(createGenerateClassName as any).mockImplementation(
|
|
|
|
() => (rule, stylesheet) => {
|
|
|
|
return [stylesheet.options.meta, rule.key, "id"].join("-");
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
jest.mock("draft-js/lib/generateRandomKey");
|
|
|
|
(generateRandomKey as any).mockImplementation(() => "testKey");
|
|
|
|
|
|
|
|
initStoryshots({
|
2019-06-19 15:23:04 +00:00
|
|
|
configPath: "src/storybook/",
|
2019-06-19 14:40:52 +00:00
|
|
|
test({ story }) {
|
|
|
|
const result = render(story.render() as any);
|
|
|
|
expect(toJSON(result)).toMatchSnapshot();
|
|
|
|
}
|
|
|
|
});
|