Skip to content

Conversation

@a-voronov
Copy link
Contributor

@a-voronov a-voronov commented Sep 4, 2018

Now we can mock calls with Signal.Event or sequence of them (corresponding to Event contract)
i.e. comparing Result with Signal.Event:

sut.sum.on { $0.right == 15 }.returns(.success(7))
// is identical to:
sut.sum.on { $0.right == 15 }.returns([.value(7), .completed])
// or this, since it adds completion event in the end of events sequence
// and if there’s no terminating event, complete will fire
// otherwise signal will terminate with any terminating event and stop sending any further events (see Event contract)
sut.sum.on { $0.right == 15 }.returns(.value(7))

and you can also have sequence of value events:

sut.fact.returns([.value(1), .value(1), .value(2), .value(6), .value(24), .completed])

will add more tests for sequence of events, but idea stays the same :)


context("when calling method before stubbing") {
fit("should return empty signal without any value") {
it("should return empty signal without any value") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, seems like we need Danger 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants