Barış Soner Uşaklı 4 years ago
parent 7069735aa2
commit 8ece64ab82

@ -95,17 +95,17 @@ describe('Controllers', function () {
assert(hookData.res); assert(hookData.res);
assert(hookData.next); assert(hookData.next);
hookData.res.render('custom', { hookData.res.render('mycustompage', {
works: true, works: true,
}); });
} }
var message = utils.generateUUID(); var message = utils.generateUUID();
var name = 'custom.tpl'; var name = 'mycustompage.tpl';
var tplPath = path.join(nconf.get('views_dir'), name); var tplPath = path.join(nconf.get('views_dir'), name);
before(async () => { before(async () => {
plugins.registerHook('myTestPlugin', { plugins.registerHook('myTestPlugin', {
hook: 'action:homepage.get:custom', hook: 'action:homepage.get:mycustompage',
method: hookMethod, method: hookMethod,
}); });
@ -224,14 +224,14 @@ describe('Controllers', function () {
}); });
it('api should work with hook', function (done) { it('api should work with hook', function (done) {
meta.configs.set('homePageRoute', 'custom', function (err) { meta.configs.set('homePageRoute', 'mycustompage', function (err) {
assert.ifError(err); assert.ifError(err);
request(nconf.get('url') + '/api', { json: true }, function (err, res, body) { request(nconf.get('url') + '/api', { json: true }, function (err, res, body) {
assert.ifError(err); assert.ifError(err);
assert.equal(res.statusCode, 200); assert.equal(res.statusCode, 200);
assert.equal(body.works, true); assert.equal(body.works, true);
assert.equal(body.template.custom, true); assert.equal(body.template.mycustompage, true);
done(); done();
}); });
@ -239,7 +239,7 @@ describe('Controllers', function () {
}); });
it('should render with hook', function (done) { it('should render with hook', function (done) {
meta.configs.set('homePageRoute', 'custom', function (err) { meta.configs.set('homePageRoute', 'mycustompage', function (err) {
assert.ifError(err); assert.ifError(err);
request(nconf.get('url'), function (err, res, body) { request(nconf.get('url'), function (err, res, body) {

Loading…
Cancel
Save