mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
test(plugins) coverage
This commit is contained in:
parent
c3bbc05f8d
commit
fa6de0ce67
2 changed files with 37 additions and 2 deletions
|
|
@ -7,7 +7,7 @@ module.exports = currify((plugins, req, res, next) => {
|
|||
if (req.url !== '/plugins.js')
|
||||
return next();
|
||||
|
||||
res.setHeader('content-type', 'application/javascript; charset=UTF-8');
|
||||
res.setHeader('content-type', 'application/javascript; charset=utf-8');
|
||||
|
||||
if (!plugins || !plugins.length)
|
||||
return res.send('');
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const test = require('supertape');
|
||||
const cloudcmd = require('..');
|
||||
const cloudcmd = require('./cloudcmd');
|
||||
|
||||
const config = {
|
||||
auth: false,
|
||||
|
|
@ -26,6 +26,22 @@ test('cloudcmd: plugins: empty', async (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: plugins: empty: header', async (t) => {
|
||||
const plugins = [];
|
||||
const options = {
|
||||
plugins,
|
||||
};
|
||||
|
||||
const {headers} = await request.get('/plugins.js', {
|
||||
options,
|
||||
});
|
||||
|
||||
const expected = 'application/javascript; charset=utf-8';
|
||||
|
||||
t.equal(headers.get('content-type'), expected, 'should content be empty');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: plugins: one', async (t) => {
|
||||
const plugins = [
|
||||
__filename,
|
||||
|
|
@ -45,6 +61,25 @@ test('cloudcmd: plugins: one', async (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: plugins: one', async (t) => {
|
||||
const plugins = [
|
||||
__filename,
|
||||
];
|
||||
|
||||
const options = {
|
||||
plugins,
|
||||
};
|
||||
|
||||
const {headers} = await request.get('/plugins.js', {
|
||||
options,
|
||||
});
|
||||
|
||||
const expected = 'application/javascript; charset=utf-8';
|
||||
|
||||
t.equal(headers.get('content-type'), expected, 'should content be empty');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: plugins: load error', async (t) => {
|
||||
const noEntry = __filename + Math.random();
|
||||
const plugins = [
|
||||
Loading…
Add table
Add a link
Reference in a new issue