mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
test(rest) JSON.parse -> type: json
This commit is contained in:
parent
f713c24ff8
commit
ef116a9a53
2 changed files with 9 additions and 5 deletions
|
|
@ -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();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue