diff options
Diffstat (limited to 'node_modules/to-buffer/test.js')
-rw-r--r-- | node_modules/to-buffer/test.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/to-buffer/test.js b/node_modules/to-buffer/test.js new file mode 100644 index 0000000..f5e97d6 --- /dev/null +++ b/node_modules/to-buffer/test.js @@ -0,0 +1,26 @@ +var tape = require('tape') +var toBuffer = require('./') + +tape('buffer returns buffer', function (t) { + t.same(toBuffer(Buffer('hi')), Buffer('hi')) + t.end() +}) + +tape('string returns buffer', function (t) { + t.same(toBuffer('hi'), Buffer('hi')) + t.end() +}) + +tape('string + enc returns buffer', function (t) { + t.same(toBuffer('6869', 'hex'), Buffer('hi')) + t.end() +}) + +tape('other input throws', function (t) { + try { + toBuffer(42) + } catch (err) { + t.same(err.message, 'Input should be a buffer or a string') + t.end() + } +}) |