-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpage.test.js
43 lines (35 loc) · 1.36 KB
/
page.test.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
var should = require('./');
var app, compound, Page;
var async = require('async');
describe('Page', function() {
before(function (done) {
app = getApp(done);
compound = app.compound;
Page = compound.models.Page;
});
describe('renderHtml', function() {
it('should render a page with 1 widget', function(done) {
Page.find(1, function(err, page) {
var url = page.url.replace(/example.com\/?/, '/');
getClient(app).get(url).end(function(err, res) {
should.not.exist(err);
should.exist(res);
res.text.should.include('Contents of single widget');
done();
});
});
});
it('should render a page with 4 different widgets on it', function(done) {
Page.find(2, function(err, page) {
var url = page.url.replace(/example.com\/?/, '/');
getClient(app).get(url).end(function(err, res) {
res.text.should.include('No group header has been set. Double-click to edit.');
res.text.should.include('Widget 2');
res.text.should.include('Widget 3');
res.text.should.include('Widget 4');
done();
});
});
});
});
});