testing in 0.4.x

33 views
Skip to first unread message

Matthew Kim

unread,
Aug 11, 2014, 1:58:45 PM8/11/14
to locomo...@googlegroups.com
var should      = require('should'),
    locomotive  = require('locomotive'),
    mongoose = require('mongoose');
    chai = require('chai'),
    expect = chai.expect,
    chaiHttp = require('chai-http');

chai.use(chaiHttp);

describe('Application', function () {
    var self = this;
    var app;
    before(function(done) {
    // boot LocomotiveJS app
    
    var lcm = new locomotive.Locomotive();
        lcm.boot('test', function() {
            app = lcm.express;
            console.log('app', app);
            app.listen(3000, function() {
                var addr = this.address();
                console.log('started', addr);
                done();
            });
        });
    });

    it('should have started the app', function(){
        should.exist(app);
    });

    it('should have loaded the home page', function () {
        chai.request(app)
          .get('/')
          .res(function(res) {
            console.log('res', res.text);
            expect(res).to.have.status(200);
          });
    });
});

If the boot function no longer takes in a directory, how does it know where to look to initialize locomotive? Ii'm failing on the get request, anything I'm doing incorrectly here?
Reply all
Reply to author
Forward
0 new messages