@25sprout/react-starter
Version:
25sprout web starter with React
50 lines (36 loc) • 906 B
JavaScript
import { shallow } from 'enzyme';
export const expect = require('expect'); // eslint-disable-line global-require
export const action = () => () => {};
export const linkTo = () => {};
export const specs = spec => {
spec();
};
export const {
describe, it, beforeEach, afterEach, xit, xdescribe, fit,
} = jasmine.currentEnv_;
export const after = () => {};
export const before = () => {};
export const snapshot = (name, func) => {
it(name, () => func());
};
const createSnapshot = (name, story) => {
it(name, () => {
expect(shallow(story)).toMatchSnapshot();
});
};
export const storiesOf = function storiesOf() {
const api = {};
let story;
api.add = (name, func) => {
story = func();
createSnapshot(name, story);
return api;
};
api.addWithInfo = (name, func) => {
story = func();
createSnapshot(name, story);
return api;
};
api.addDecorator = () => {};
return api;
};