mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
test(rest) formatMsg
This commit is contained in:
parent
ecbf8f2fe5
commit
38291f1fc3
2 changed files with 37 additions and 8 deletions
24
test/server/rest.js
Normal file
24
test/server/rest.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
'use strict';
|
||||
|
||||
const test = require('tape');
|
||||
const rest = require('../../server/rest');
|
||||
const {
|
||||
_formatMsg,
|
||||
} = rest;
|
||||
|
||||
test('rest: formatMsg', (t) => {
|
||||
const result = _formatMsg('hello', 'world');
|
||||
|
||||
t.equal(result, 'hello: ok("world")');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('rest: formatMsg: json', (t) => {
|
||||
const result = _formatMsg('hello', {
|
||||
name: 'world',
|
||||
});
|
||||
|
||||
t.equal(result, 'hello: ok("{"name":"world"}")');
|
||||
t.end();
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue