Skip to content

Commit be6059f

Browse files
test(overmind): fix operator path test
1 parent a0bb156 commit be6059f

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

packages/node_modules/overmind/src/operator.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ describe('OPERATOR', () => {
100100
if (err) next(err, value)
101101
else
102102
next(null, value, {
103-
name: value,
104-
operator: paths[value],
103+
path: {
104+
name: value,
105+
operator: paths[value],
106+
},
105107
})
106108
})
107109
}

packages/node_modules/overmind/src/operators.test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
IOperator,
1010
wait,
1111
debounce,
12-
action,
12+
mutate,
1313
parallel,
1414
IConfig,
1515
IAction,
@@ -22,7 +22,7 @@ describe('OPERATORS', () => {
2222
expect.assertions(1)
2323
const test: Operator<string> = pipe(
2424
map((_, value) => value.toUpperCase()),
25-
action(({ state }, value) => (state.foo = value))
25+
mutate(({ state }, value) => (state.foo = value))
2626
)
2727

2828
const state = {
@@ -51,7 +51,7 @@ describe('OPERATORS', () => {
5151
expect.assertions(1)
5252
const test: Operator<string> = pipe(
5353
map((_, value) => Promise.resolve(value.toUpperCase())),
54-
action(({ state }, value) => (state.foo = value))
54+
mutate(({ state }, value) => (state.foo = value))
5555
)
5656

5757
const state = {
@@ -139,7 +139,7 @@ describe('OPERATORS', () => {
139139
const test: Operator<string> = pipe(
140140
filter((_, value) => value === 'foo'),
141141
map((_, value) => value.toUpperCase()),
142-
action(({ state }, value) => (state.foo = value))
142+
mutate(({ state }, value) => (state.foo = value))
143143
)
144144

145145
const state = {
@@ -167,7 +167,7 @@ describe('OPERATORS', () => {
167167
const test: Operator<string> = pipe(
168168
filter((_, value) => value === 'bar'),
169169
map((_, value) => value.toUpperCase()),
170-
action(({ state }, value) => (state.foo = value))
170+
mutate(({ state }, value) => (state.foo = value))
171171
)
172172

173173
const state = {
@@ -197,7 +197,7 @@ describe('OPERATORS', () => {
197197
fork(() => 'foo', {
198198
foo: pipe(
199199
map((_, value) => value.toUpperCase()),
200-
action(({ state }, value) => (state.foo = value))
200+
mutate(({ state }, value) => (state.foo = value))
201201
),
202202
})
203203
)
@@ -231,11 +231,11 @@ describe('OPERATORS', () => {
231231
when(() => true, {
232232
true: pipe(
233233
map((_, value) => value.toUpperCase()),
234-
action(({ state }, value) => (state.foo = value))
234+
mutate(({ state }, value) => (state.foo = value))
235235
),
236236
false: pipe(
237237
map((_, value) => Number(value)),
238-
action(({ state }, value) => (state.number = value))
238+
mutate(({ state }, value) => (state.number = value))
239239
),
240240
})
241241
)
@@ -292,7 +292,7 @@ describe('OPERATORS', () => {
292292
expect.assertions(1)
293293
const test: Operator = pipe(
294294
debounce(100),
295-
action(({ state }) => state.runCount++)
295+
mutate(({ state }) => state.runCount++)
296296
)
297297
const state = {
298298
runCount: 0,
@@ -319,18 +319,18 @@ describe('OPERATORS', () => {
319319
test('catchError', () => {
320320
expect.assertions(3)
321321
const test: Operator<string> = pipe(
322-
action(() => {
322+
mutate(() => {
323323
throw new Error('wut?!?')
324324
}),
325-
action(({ state }) => {
325+
mutate(({ state }) => {
326326
state.runCount++
327327
}),
328328
catchError(({ state }, error) => {
329329
state.error = error.message
330330

331331
return 'hm'
332332
}),
333-
action(({ state }, value) => {
333+
mutate(({ state }, value) => {
334334
state.foo = value
335335
})
336336
)
@@ -361,10 +361,10 @@ describe('OPERATORS', () => {
361361
test('tryCatch - resolves', () => {
362362
expect.assertions(1)
363363
const test: Operator<string> = tryCatch({
364-
try: action(({ state }, value) => {
364+
try: mutate(({ state }, value) => {
365365
state.foo = value
366366
}),
367-
catch: action(() => {}),
367+
catch: mutate(() => {}),
368368
})
369369
const state = {
370370
foo: 'bar',
@@ -390,10 +390,10 @@ describe('OPERATORS', () => {
390390
expect.assertions(1)
391391
const test: Operator<string> = pipe(
392392
tryCatch({
393-
try: action(() => {
393+
try: mutate(() => {
394394
throw new Error('ehm')
395395
}),
396-
catch: action(({ state }, value) => {
396+
catch: mutate(({ state }, value) => {
397397
state.foo = value.message
398398
}),
399399
})

0 commit comments

Comments
 (0)