mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(markdown) coverage
This commit is contained in:
parent
56a833516d
commit
594d3770b2
2 changed files with 23 additions and 2 deletions
|
|
@ -10,11 +10,11 @@ const markdown = require('markdown-it')();
|
|||
const root = require('./root');
|
||||
|
||||
module.exports = (name, request, callback) => {
|
||||
check(name, request, callback);
|
||||
|
||||
const method = request.method;
|
||||
const query = ponse.getQuery(request);
|
||||
|
||||
check(name, request, callback);
|
||||
|
||||
switch(method) {
|
||||
case 'GET':
|
||||
name = name.replace('/markdown', '');
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ const promisify = require('es6-promisify');
|
|||
const pullout = require('pullout');
|
||||
const request = require('request');
|
||||
|
||||
const markdown = require('../../server/markdown');
|
||||
|
||||
const before = require('../before');
|
||||
|
||||
const warp = (fn, ...a) => (...b) => fn(...b, ...a);
|
||||
|
|
@ -44,3 +46,22 @@ test('cloudcmd: markdown: relative', (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test('cloudcmd: markdown: no name', (t) => {
|
||||
t.throws(markdown, /name should be string!/, 'should throw when no name');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: markdown: no request', (t) => {
|
||||
const fn = () => markdown('hello');
|
||||
|
||||
t.throws(fn, /request could not be empty!/, 'should throw when no request');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: markdown: no function', (t) => {
|
||||
const fn = () => markdown('hello', {});
|
||||
|
||||
t.throws(fn, /callback should be function!/, 'should throw when no callback');
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue