redux-devtools/packages/redux-devtools-inspector-monitor-test-tab/src/vanilla/ava/index.ts
Nathan Bierema 9fdd298dc3
chore(test): rename test-generator to test-tab (#649)
* chore(test): rename test-generator to test-tab

* And those

* Prettify
2020-10-04 00:01:46 -04:00

21 lines
602 B
TypeScript

import { AssertionLocals, DispatcherLocals, WrapLocals } from '../../types';
export const name = 'Ava template';
export const dispatcher = ({ action }: DispatcherLocals) => `${action!};`;
export const assertion = ({ path, curState }: AssertionLocals) =>
`t.deepEqual(state${path}, ${curState!});`;
export const wrap = ({ name, initialState, assertions }: WrapLocals) =>
`import test from 'ava';
import ${name!} from '../../stores/${name!}';
test('${name!}', (t) => {
const store = new ${name!}(${initialState!});
${assertions}
});
`;
export default { name, assertion, dispatcher, wrap };