Skip to content

Commit

Permalink
feat(onUnhandled*): decided on the name of the API.
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePrimeagen committed Dec 18, 2015
1 parent 13ef249 commit 0895ad5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Router.prototype = {
* have a chance to fulfill that request.
* @param {DataSource} dataSource -
*/
onUnhandledOperation: function unhandledDataSource(dataSource) {
routeUnhandledPathsTo: function routeUnhandledPathsTo(dataSource) {
this._unhandled = dataSource;
}
};
Expand Down
4 changes: 2 additions & 2 deletions test/unit/functional/unhandled.call.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('#call', function() {
]
});
});
router.onUnhandledOperation({
router.routeUnhandledPathsTo({
call: onCall
});
var onNext = sinon.spy();
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('#call', function() {
]
});
});
router.onUnhandledOperation({
router.routeUnhandledPathsTo({
call: onCall
});
var onNext = sinon.spy();
Expand Down
10 changes: 5 additions & 5 deletions test/unit/functional/unhandled.get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('#get', function() {
var onUnhandledPaths = sinon.spy(function convert(paths) {
return Observable.empty();
});
router.onUnhandledOperation({get: onUnhandledPaths});
router.routeUnhandledPathsTo({get: onUnhandledPaths});

var obs = router.
get([['videos', 'summary']]);
Expand All @@ -35,7 +35,7 @@ describe('#get', function() {
}).
subscribe(noOp, done, done);
});
it('should call the onUnhandledOperation when the route completely misses a route.', function(done) {
it('should call the routeUnhandledPathsTo when the route completely misses a route.', function(done) {
var router = new R([]);
var onUnhandledPaths = sinon.spy(function convert(paths) {
var returnValue = paths.reduce(function(jsonGraph, path) {
Expand All @@ -47,7 +47,7 @@ describe('#get', function() {
}, {jsonGraph: {}});
return Observable.return(returnValue);
});
router.onUnhandledOperation({get: onUnhandledPaths});
router.routeUnhandledPathsTo({get: onUnhandledPaths});

var obs = router.
get([['videos', 'summary']]);
Expand All @@ -70,7 +70,7 @@ describe('#get', function() {
subscribe(noOp, done, done);
});

it('should call the onUnhandledOperation when the route partially misses a route.', function(done) {
it('should call the routeUnhandledPathsTo when the route partially misses a route.', function(done) {
var router = new R([{
route: 'videos.length',
get: function() {
Expand All @@ -90,7 +90,7 @@ describe('#get', function() {
}, {jsonGraph: {}});
return Observable.return(returnValue);
});
router.onUnhandledOperation({get: onUnhandledPaths});
router.routeUnhandledPathsTo({get: onUnhandledPaths});

var obs = router.
get([['videos', ['length', 'summary']]]);
Expand Down
12 changes: 6 additions & 6 deletions test/unit/functional/unhandled.set.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('#set', function() {
var onUnhandledPaths = sinon.spy(function convert(paths) {
return Observable.empty();
});
router.onUnhandledOperation({set: onUnhandledPaths});
router.routeUnhandledPathsTo({set: onUnhandledPaths});

var obs = router.
set({
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('#set', function() {
}).
subscribe(noOp, done, done);
});
it('should call the onUnhandledOperation when the route completely misses a route.', function(done) {
it('should call the routeUnhandledPathsTo when the route completely misses a route.', function(done) {
var router = new R([]);
var onUnhandledPaths = sinon.spy(function convert(jsonGraphEnv) {
var returnValue = jsonGraphEnv.paths.reduce(function(jsonGraph, path) {
Expand All @@ -65,7 +65,7 @@ describe('#set', function() {

return Observable.return(returnValue);
});
router.onUnhandledOperation({set: onUnhandledPaths});
router.routeUnhandledPathsTo({set: onUnhandledPaths});

var obs = router.
set({
Expand Down Expand Up @@ -104,7 +104,7 @@ describe('#set', function() {
subscribe(noOp, done, done);
});

it('should call the onUnhandledOperation when the route partially misses a route.', function(done) {
it('should call the routeUnhandledPathsTo when the route partially misses a route.', function(done) {
var router = new R([{
route: 'videos.length',
set: function() {
Expand All @@ -124,7 +124,7 @@ describe('#set', function() {
}, {jsonGraph: {}});
return Observable.return(returnValue);
});
router.onUnhandledOperation({set: onUnhandledPaths});
router.routeUnhandledPathsTo({set: onUnhandledPaths});

var obs = router.
set({
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('#set', function() {
});
return Observable.return(next);
});
router.onUnhandledOperation({set: onUnhandledPaths});
router.routeUnhandledPathsTo({set: onUnhandledPaths});

var obs = router.
set({
Expand Down

0 comments on commit 0895ad5

Please sign in to comment.