Skip to content

Instantly share code, notes, and snippets.

@petrjanda
Created January 13, 2012 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrjanda/1606059 to your computer and use it in GitHub Desktop.
Save petrjanda/1606059 to your computer and use it in GitHub Desktop.
// APP
var http = require('http');
module.exports = App = function() {}
App.prototype.init = function(options) {
// handle options
this.server = http.createServer(...)
}
// TEST
var http = require('http'),
App = require('./app');
describe('App', function() {
var app;
beforeEach(function() {
app = new App();
})
describe('.init', function() {
it('should create http server', function() {
spyOn(http, 'createServer');
app.init({port: 3000});
expect(http.createServer).toHaveBeenCalledWith(...)
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment