Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement callback stubbing APIs #70

Merged
merged 3 commits into from
Mar 9, 2016
Merged

Implement callback stubbing APIs #70

merged 3 commits into from
Mar 9, 2016

Conversation

searls
Copy link
Member

@searls searls commented Mar 9, 2016

Fixes #66

The test structure has made no sense since we introduced 
browserify. At this point, the more honest thing is to
admit the test suite is all integration and will only 
exercise the lib through the top-level object.

Some tests will need to be Node.js only, like
`test/lib/testdouble-test.js`, which makes zero 
sense when invoked against the browserified bundle.

Remove the interactive testem config, since it didn't work to
begin with.
I couldn't settle on a universally best way to stub callback
arguments, so I implemented several options.

The only option I didn't include was the one I personally wanted
most:

```
td.when(myTd(td.callback(123)))
```

Because I didn't want to cook up some sneaky way of figuring
out whether or not the `td.when.thenX` was going to be invoked
or not. 

I imagine in simple cases, an implied last-arg callback plus
thenCallback will be preferable, but in complex cases (say,
where both a callback and the return value matter), then the
td.callback(args...) matcher + thenReturn will allow more 
complete stubbings

I still need to noodle on how this might be used to simplify
multi-step callback verifications, but the stubbing alone
may be enough to cover those cases
searls added a commit that referenced this pull request Mar 9, 2016
@searls searls merged commit 4570716 into master Mar 9, 2016
@searls searls deleted the promises-and-callbacks branch March 9, 2016 00:56
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.

None yet

1 participant