forked from publicclass/express-partials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.partials.register.js
67 lines (59 loc) · 2.29 KB
/
test.partials.register.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var app = require('./fixtures/register/app')
, request = require('supertest')
, partials = require('../');
describe('app',function(){
describe('GET /register',function(){
it('should render index.j as a Jade template with layout.j as Jade layout (register: function)',function(done){
partials.register('.j',require('jade').render);
request(app)
.get('/register')
.expect(200)
.expect('<html><head><title>Jade layout</title></head><body><h2>Jade says hello world</h2></body></html>')
.end(done)
})
it('should render index.j as a Jade template with layout.j as Jade layout (register: module)',function(done){
partials.register('.j',require('jade'));
request(app)
.get('/register')
.expect(200)
.expect('<html><head><title>Jade layout</title></head><body><h2>Jade says hello world</h2></body></html>')
.end(done)
})
it('should render index.j as a Jade template with layout.j as Jade layout (register: name)',function(done){
partials.register('.j','jade');
request(app)
.get('/register')
.expect(200)
.expect('<html><head><title>Jade layout</title></head><body><h2>Jade says hello world</h2></body></html>')
.end(done)
})
})
describe('GET /register/no-layout',function(){
it('should render index.j as a Jade template (using only Express 3.x)',function(done){
partials.register('.j',{});
request(app)
.get('/register/no-layout')
.expect(200)
.expect('<h2>Jade says hello world</h2>')
.end(done)
})
})
describe('GET /eco',function(){
it('should render index.eco as a Eco template with layout.eco as Eco layout',function(done){
request(app)
.get('/eco')
.expect(200)
.expect('<html><head><title>Eco layout</title></head><body><h2>Eco says hello world</h2>\n</body></html>\n')
.end(done)
})
})
describe('GET /coffeecup',function(){
it('should render index.coffeecup as a CoffeeCup template with layout.coffeecup as CoffeeCup layout',function(done){
request(app)
.get('/coffeecup')
.expect(200)
.expect('<html><head><title>CoffeeCup layout</title></head><body><h2>CoffeeCup says hello world</h2></body></html>')
.end(done)
})
})
})