compound-ex4
Version:
Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)
36 lines (33 loc) • 1.05 kB
JavaScript
var should = require('./init.js');
var app;
describe('controller', function () {
before(function (done) {
app = getApp();
app.compound.on('ready', function () {
done();
});
});
it('should be reusable', function (done) {
function Controller() {}
var f = 14;
var a = 24;
Controller.prototype.first = function first(c) {
f = 41;
c.next();
};
Controller.prototype.second = function second(c) {
a = 42;
c.next();
};
app.compound.structure.controllers.test = Controller;
app.compound.controllerBridge.callControllerAction('test', 'first', {}, {}, function (err) {
should.not.exists(err);
app.compound.controllerBridge.callControllerAction('test', 'second', {}, {}, function (err) {
should.not.exists(err);
f.should.equal(41);
a.should.equal(42);
done();
});
});
});
});