Skip to content
Myr

Added test for dynamic helper cache

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent f70232d · Browse files · 1 file+9 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−4 removed

  • tests:+9 added−4 removed

1 file+9 added−4 removed

modified:test/view.test.js+9 added-4 removed
242 unmodified lines
243 'Content-Type': 'text/html; charset=utf-8'244 }});245 },246 247 'test #render() view helpers': function(assert){248 var app = create();247 'test #render() view helpers': function(assert, beforeExit){248 var app = create(),249 calls = 0;250251 app.helpers({ 252 lastName: 'holowaychuk',253 greetings: function(sess, lastName){
2 unmodified lines
256 });257258 var ret = app.dynamicHelpers({259 session: function(req, res){260 ++calls;261 assert.equal('object', typeof req, 'Test dynamic helper req');262 assert.equal('object', typeof res, 'Test dynamic helper res');263 assert.ok(this instanceof express.Server, 'Test dynamic helper app scope');264 return req.session;
12 unmodified lines
277 });278 app.get('/precedence', function(req, res){279 req.session = { name: 'tj' };280 res.render('dynamic-helpers.jade', {279 layout: false,281 locals: {282 lastName: 'foobar'283 }284 });
6 unmodified lines
291 { url: '/ejs' },292 { body: '<p>Hello tj holowaychuk</p>' });293 assert.response(app,294 { url: '/precedence' },294 { body: '<p>Hello tj foobar</p>' });295 { body: '<html><body><p>Hello tj foobar</p></body></html>' });296297 beforeExit(function(){298 assert.equal(3, calls);299 });300 },301 302 'test #partial()': function(assert){303 var app = create();
203 unmodified lines