mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: test for https://github.com/NodeBB/NodeBB/pull/9180
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user