vigetlabs / gangway

A client-side API abstraction layer
MIT License
13 stars 1 forks source link

Add Stubbing Behavior for Test Fixture Use Case #19

Open solomonhawk opened 8 years ago

solomonhawk commented 8 years ago

I think this could work a lot like Sinon.js' Stub where you can create a thing that returns specific responses in a specific order or throws at a specific point. This would allow better testability of API response handling within an app when the API is mocked.

nhunzaker commented 8 years ago

Interesting idea. I wonder if you could actually just use sinon, setting up a stub and integrating it like:

var mock = sinon.stub()

/// build stub....

API.resource.get({ mock })