app.engine.js
This file
Path
test/app.engine.js
38 lines · 946 bytes · JavaScript
Last changed by
Added app.engine() testsTj Holowaychukbefore adoption66f8ca5
History of this fileTake it
Added app.engine() testsTj Holowaychukbefore adoption66f8ca5
lines 1–38why, one step back12var express = require('../')3 , assert = require('assert');45function render(str, options, fn) {6 str = str.replace('{{user.name}}', options.user.name);7 fn(null, str);8}910describe('app', function(){11 describe('.engine(ext, fn)', function(){12 it('should map a template engine', function(){13 var app = express();1415 app.set('views', __dirname + '/fixtures');16 app.engine('.html', render);17 app.locals.user = { name: 'tobi' };1819 app.render('user.html', function(err, str){20 assert(null == err);21 str.should.equal('<p>tobi</p>');22 })23 })24 25 it('should work without leading "."', function(){26 var app = express();2728 app.set('views', __dirname + '/fixtures');29 app.engine('html', render);30 app.locals.user = { name: 'tobi' };3132 app.render('user.html', function(err, str){33 assert(null == err);34 str.should.equal('<p>tobi</p>');35 })36 })37 })38})