test: composer

This commit is contained in:
Barış Soner Uşaklı
2022-02-17 22:24:05 -05:00
parent cb34728421
commit 6bfc53fc6f

View File

@@ -2348,7 +2348,7 @@ describe('Controllers', () => {
});
it('should load the composer route', (done) => {
request(`${nconf.get('url')}/api/compose`, { json: true }, (err, res, body) => {
request(`${nconf.get('url')}/api/compose?cid=1`, { json: true }, (err, res, body) => {
assert.ifError(err);
assert.equal(res.statusCode, 200);
assert(body.title);
@@ -2369,7 +2369,7 @@ describe('Controllers', () => {
method: hookMethod,
});
request(`${nconf.get('url')}/api/compose`, { json: true }, (err, res, body) => {
request(`${nconf.get('url')}/api/compose?cid=1`, { json: true }, (err, res, body) => {
assert.ifError(err);
assert.equal(res.statusCode, 200);
assert(body.title);
@@ -2381,26 +2381,6 @@ describe('Controllers', () => {
});
});
it('should 404 if plugin calls next', (done) => {
function hookMethod(hookData, callback) {
hookData.next();
}
plugins.hooks.register('myTestPlugin', {
hook: 'filter:composer.build',
method: hookMethod,
});
request(`${nconf.get('url')}/api/compose`, { json: true }, (err, res, body) => {
assert.ifError(err);
assert.equal(res.statusCode, 404);
plugins.hooks.unregister('myTestPlugin', 'filter:composer.build', hookMethod);
done();
});
});
it('should error with invalid data', (done) => {
request.post(`${nconf.get('url')}/compose`, {
form: {