Last active
December 19, 2015 21:19
-
-
Save wwqrd/6019708 to your computer and use it in GitHub Desktop.
This file contains 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
var IndexRoutes = require( 'index' ); | |
var indexRoutes; | |
indexRoutes = routes.generate({ | |
config = options.config; | |
logger = options.logger; | |
Metric = options.Metric; | |
}); | |
app.get( '/something', indexRoutes.awesome ); | |
This file contains 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
var async = require( 'async' ); | |
var IndexRoutes = function( options ) { | |
config = options.config; | |
logger = options.logger; | |
Metric = options.Metric; | |
awesomeRouteMethod = function( req, res ) { | |
}; | |
return { | |
awesome: awesomeRouteMethod; | |
}; | |
}; | |
module.exports = IndexRoutes; |
This file contains 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
var IndexRoutes = require( 'index' ); | |
var indexRoutes; | |
// define fake objects | |
// ... | |
indexRoutes = routes.generate({ | |
config = fakeOptions; | |
logger = fakeLogger; | |
Metric = fakeMetrics; | |
}); | |
describe( 'awesome route', function() { | |
it( 'should call Metrics with options', function( done ) { | |
indexRoutes.awesome( fakeReq, { | |
jsonp: function() { | |
expect(fakeMetrics.calledOnce).to.be.true; | |
done(); | |
} | |
}); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment