Skip to content

Instantly share code, notes, and snippets.

@wwqrd
Last active December 19, 2015 21:19
Show Gist options
  • Save wwqrd/6019708 to your computer and use it in GitHub Desktop.
Save wwqrd/6019708 to your computer and use it in GitHub Desktop.
var IndexRoutes = require( 'index' );
var indexRoutes;
indexRoutes = routes.generate({
config = options.config;
logger = options.logger;
Metric = options.Metric;
});
app.get( '/something', indexRoutes.awesome );
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;
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