Skip to content

Commit b8b1db4

Browse files
committed
fixing tests to match changes in fx api
1 parent 5e37056 commit b8b1db4

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

test/fx/BatchFx.test.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,22 @@ describe("BatchFx effect", () => {
88
expect(dispatch).not.toBeCalled()
99
})
1010
it("should dispatch single fx", () => {
11-
const props = {}
1211
const effect = jest.fn()
13-
const batchFx = BatchFx({ props, effect })
12+
const fx = { key: "value", effect }
13+
const batchFx = BatchFx(fx)
1414
const { dispatch } = runFx(batchFx)
15-
expect(effect).toBeCalledWith(props, dispatch)
15+
expect(effect).toBeCalledWith(fx, dispatch)
1616
})
1717
it("should dispatch multiple fx", () => {
1818
const props1 = { first: "props" }
1919
const effect1 = jest.fn()
2020
const props2 = { second: "props" }
2121
const effect2 = jest.fn()
22-
const batchFx = BatchFx(
23-
{ props: props1, effect: effect1 },
24-
{ props: props2, effect: effect2 }
25-
)
22+
const fx1 = { props: props1, effect: effect1 }
23+
const fx2 = { props: props2, effect: effect2 }
24+
const batchFx = BatchFx(fx1, fx2)
2625
const { dispatch } = runFx(batchFx)
27-
expect(effect1).toBeCalledWith(props1, dispatch)
28-
expect(effect2).toBeCalledWith(props2, dispatch)
26+
expect(effect1).toBeCalledWith(fx1, dispatch)
27+
expect(effect2).toBeCalledWith(fx2, dispatch)
2928
})
3029
})

test/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const runFx = fx => {
22
const dispatch = jest.fn()
3-
const unsubscribe = fx.effect(fx.props, dispatch)
3+
const unsubscribe = fx.effect(fx, dispatch)
44
return { dispatch, unsubscribe }
55
}

0 commit comments

Comments
 (0)