Created
November 16, 2017 16:30
-
-
Save PaulTaykalo/a27e8109df9d95689b539b9135499000 to your computer and use it in GitHub Desktop.
From To
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FROM: | |
let callSpy1 = CallSpy.makeCallSpy(f2: testReduce) | |
let callSpy2 = CallSpy.makeCallSpy(f2: testReduce) | |
let store: Store<Int, IntegerArithmeticAction> = Store(state: 0, reducers: [callSpy1.1, callSpy2.1]) | |
store.consume(event: .increment) | |
store.consume(event: .decrement) | |
store.consume(event: .add(1)) | |
store.consume(event: .subtract(1)) | |
expect(callSpy1.0.callCount).to(equal(4)) | |
expect(callSpy2.0.callCount).to(equal(4)) | |
// TO: | |
let (store, reducer1, reducer2) = createSUT(reducer1: testReduce , reducer2: testReduce) | |
store.consume(event: .increment) | |
store.consume(event: .decrement) | |
store.consume(event: .add(1)) | |
store.consume(event: .subtract(1)) | |
expect(reducer2.callCount).to(equal(4)) | |
expect(reducer2.callCount).to(equal(4)) | |
fileprivate func createSUT(reducer1: Reducer? , reducer2: Reducer?) -> (Store, reducer1, reducer2) { | |
let callSpy1 = CallSpy.makeCallSpy(f2: testReduce) | |
let callSpy2 = CallSpy.makeCallSpy(f2: testReduce) | |
let store: Store<Int, IntegerArithmeticAction> = Store(state: 0, reducers: [callSpy1.1, callSpy2.1]) | |
return (store, callSpy1.0, callSpy2.0) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment