-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from HeZai/f_add_defaultCtrlData
add: 增加 views 中间件 test
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/**! | ||
* gracejs - test/views.test.js | ||
* Copyright(c) 2019 | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* hezai | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var koa = require('koa'); | ||
var app = require('../middleware/views/example/app'); | ||
var request = require('supertest'); | ||
var mm = require('mm'); | ||
|
||
describe('test/views.test.js', function() { | ||
afterEach(function() {}); | ||
|
||
describe('set DefaultCtrlData', function() { | ||
it('页面渲染', function(done) { | ||
request(app) | ||
.get('/') | ||
.expect(200, done); | ||
}); | ||
|
||
it('设置模板渲染全局变量', function(done) { | ||
request(app) | ||
.get('/') | ||
.expect(200) | ||
.end(function(err, res) { | ||
if(/this is defaultCtrlData/.test(res.text)) { | ||
done(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |