From 7cb681f293f7fadde639b6653942aaed5c46cd96 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 2 Aug 2017 12:20:58 +0300 Subject: [PATCH] test(cloudfunc) getPathLink --- common/cloudfunc.js | 1 + test/common/cloudfunc.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/common/cloudfunc.js b/common/cloudfunc.js index 9d93467c..e682a520 100644 --- a/common/cloudfunc.js +++ b/common/cloudfunc.js @@ -22,6 +22,7 @@ module.exports.apiURL = '/api/v1'; module.exports.MAX_FILE_SIZE = 500 * 1024; module.exports.Entity = Entity; module.exports.getHeaderField = getHeaderField; +module.exports.getPathLink = getPathLink; module.exports.formatMsg = (msg, name, status) => { status = status || 'ok'; diff --git a/test/common/cloudfunc.js b/test/common/cloudfunc.js index b0c5c8fe..ea0f4f90 100644 --- a/test/common/cloudfunc.js +++ b/test/common/cloudfunc.js @@ -199,3 +199,17 @@ test('cloudfunc: getHeaderField', (t) => { t.end(); }); +test('cloudfunc: getPathLink: no url', (t) => { + t.throws(CloudFunc.getPathLink, 'should throw when no url'); + t.end(); +}); + +test('cloudfunc: getPathLink: no template', (t) => { + const url = 'http://abc.com'; + const prefix = ''; + const fn = () => CloudFunc.getPathLink(url, prefix); + + t.throws(fn, 'should throw when no template'); + t.end(); +}); +