splat.test => ts

This commit is contained in:
Yanick Champoux 2019-10-23 17:51:47 -04:00
parent f0e3b15fa4
commit 07eaf93e48
2 changed files with 6 additions and 5 deletions

View File

@ -7,6 +7,7 @@
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"@types/jest": "^24.0.19",
"@types/lodash": "^4.14.144",
"babel-jest": "^24.9.0",
"jest": "^24.9.0",

View File

@ -1,13 +1,13 @@
import updux from '.';
import u from 'updeep';
const tracer = chr => u({ tracer: s => (s||'') + chr });
const tracer = (chr:string) => u({ tracer: (s='') => s + chr });
test( 'mutations, simple', () => {
const dux = updux({
mutations: {
foo: () => tracer('a'),
'*': (p,a) => tracer('b'),
'*': () => tracer('b'),
},
});
@ -28,14 +28,14 @@ test( 'with subduxes', () => {
const dux = updux({
mutations: {
foo: () => tracer('a'),
'*': (dummy,a) => tracer('b'),
bar: () => ({bar}) => ({ bar, tracer: bar.tracer })
'*': () => tracer('b'),
bar: () => ({bar}:any) => ({ bar, tracer: bar.tracer })
},
subduxes: {
bar: updux({
mutations: {
foo: () => tracer('d'),
'*': (dummy,a) => tracer('e'),
'*': () => tracer('e'),
},
}),
},