mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
fix(markdown) DIR_ROOT: help
This commit is contained in:
parent
aea236bd18
commit
14dcd69a1d
2 changed files with 47 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
const DIR_ROOT = __dirname + '/../../';
|
||||
const DIR_ROOT = __dirname + '/../';
|
||||
const fs = require('fs');
|
||||
|
||||
const pullout = require('pullout/legacy');
|
||||
|
|
|
|||
46
test/server/markdown.js
Normal file
46
test/server/markdown.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const promisify = require('es6-promisify');
|
||||
const pullout = require('pullout');
|
||||
const request = require('request');
|
||||
|
||||
const before = require('../before');
|
||||
|
||||
const warp = (fn, ...a) => (...b) => fn(...b, ...a);
|
||||
const _pullout = promisify(pullout);
|
||||
|
||||
const get = promisify((url, fn) => {
|
||||
fn(null, request(url));
|
||||
});
|
||||
|
||||
test('cloudcmd: markdown: relative: error', (t) => {
|
||||
before((port, after) => {
|
||||
get(`http://localhost:${port}/api/v1/markdown/not-found?relative`)
|
||||
.then(warp(_pullout, 'string'))
|
||||
.then((result) => {
|
||||
t.ok(/ENOENT/.test(result), 'should not found');
|
||||
t.end();
|
||||
after();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('cloudcmd: markdown: relative', (t) => {
|
||||
before((port, after) => {
|
||||
get(`http://localhost:${port}/api/v1/markdown/HELP.md?relative`)
|
||||
.then(warp(_pullout, 'string'))
|
||||
.then((result) => {
|
||||
t.notOk(/ENOENT/.test(result), 'should not return error');
|
||||
t.end();
|
||||
after();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue