diff --git a/test/server/fixture/markdown.html b/test/server/fixture/markdown.html
new file mode 100644
index 00000000..6e7c1e6a
--- /dev/null
+++ b/test/server/fixture/markdown.html
@@ -0,0 +1 @@
+
hello
diff --git a/test/server/fixture/markdown.md b/test/server/fixture/markdown.md
new file mode 100644
index 00000000..8954bb97
--- /dev/null
+++ b/test/server/fixture/markdown.md
@@ -0,0 +1 @@
+# hello
diff --git a/test/server/markdown.js b/test/server/markdown.js
index 780d548f..553494b6 100644
--- a/test/server/markdown.js
+++ b/test/server/markdown.js
@@ -1,5 +1,7 @@
'use strict';
+const fs = require('fs');
+const path = require('path');
const test = require('tape');
const promisify = require('es6-promisify');
const pullout = require('pullout');
@@ -46,6 +48,33 @@ test('cloudcmd: markdown: relative', (t) => {
});
});
+test('cloudcmd: markdown: put', (t) => {
+ const dir = path.join(__dirname, 'fixture');
+ const md = path.join(dir, 'markdown.md');
+ const html = path.join(dir, 'markdown.html');
+
+ const mdStream = fs.createReadStream(md);
+ const htmlFile = fs.readFileSync(html, 'utf8');
+
+ before((port, after) => {
+ const url = `http://localhost:${port}/api/v1/markdown`;
+
+ const putStream = mdStream
+ .pipe(request.put(url));
+
+ _pullout(putStream, 'string')
+ .then((result) => {
+ t.equal(result, htmlFile, 'should render markdown input to html');
+ t.end();
+ after();
+ })
+ .catch((error) => {
+ t.fail(error.message);
+ t.end();
+ });
+ });
+});
+
test('cloudcmd: markdown: no name', (t) => {
t.throws(markdown, /name should be string!/, 'should throw when no name');
t.end();