Thursday 17 May 2018

How do I set up a test server with mocha?

// test/login.jsvar app = require('../index'); var http = require('http'); var Browser = require('zombie'); describe('login', function() { before(function() { this.server = http.createServer(app).listen(3000); this.browser = new Browser({ site: 'http://localhost:3000' }); }); before(function(done) { this.browser.visit('/', done); }); it('should see should username', function() { assert.ok(this.browser.success); assert.equal(this.browser.text('#username'), 'user101'); }); after(function(done) { this.server.close(done); }); }); I get a listener should be a function error.

Submitted May 17, 2018 at 06:24AM by eggtart_prince

No comments:

Post a Comment