test(rest) JSON.parse -> type: json

This commit is contained in:
coderaiser 2018-11-08 22:34:26 +02:00
parent f713c24ff8
commit ef116a9a53
2 changed files with 9 additions and 5 deletions

View file

@ -19,10 +19,11 @@ const manageConfig = require('../../server/config');
const pathConfig = path.join(os.homedir(), '.cloudcmd.json');
test('cloudcmd: rest: config: get', async (t) => {
const {body} = await request.get('/api/v1/config');
const config = JSON.parse(body);
const {body} = await request.get('/api/v1/config', {
type: 'json'
});
t.notOk(config.auth, 'should config.auth to be false');
t.notOk(body.auth, 'should config.auth to be false');
t.end();
});

View file

@ -7,8 +7,11 @@ const cloudcmd = require('../..');
const {request} = require('serve-once')(cloudcmd);
test('cloudcmd: rest: fs: path', async (t) => {
const {body} = await request.get(`/api/v1/fs`);
const {path} = JSON.parse(body);
const {body} = await request.get(`/api/v1/fs`, {
type: 'json'
});
const {path} = body;
t.equal('/', path, 'should dir path be "/"');
t.end();