test(rest) formatMsg

This commit is contained in:
coderaiser 2017-10-23 18:02:07 +03:00
parent ecbf8f2fe5
commit 38291f1fc3
2 changed files with 37 additions and 8 deletions

24
test/server/rest.js Normal file
View 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();
});