diff --git a/test/byteSize/byteSize.test.js b/test/byteSize/byteSize.test.js index b79b83889..30a010ab0 100644 --- a/test/byteSize/byteSize.test.js +++ b/test/byteSize/byteSize.test.js @@ -1,10 +1,22 @@ const test = require('tape'); -const byteSize = require('./byteSize.js'); - +// Custom implementation of Blob for the requirements of this snippet. +const Blob = class{ + constructor(s) { + return { + size: Buffer.byteLength(s.toString()) + }; + } +} +// const byteSize = require('./byteSize.js'); +// Override +const byteSize = str => new Blob([str]).size; test('Testing byteSize', (t) => { //For more information on all the methods supported by tape //Please go to https://github.com/substack/tape t.true(typeof byteSize === 'function', 'byteSize is a Function'); + t.equal(byteSize('a'), 1, 'Works for a single letter'); + t.equal(byteSize('Hello World'), 11, 'Works for a common string'); + t.equal(byteSize('😀'), 4, 'Works for emoji'); // Blob is not part of Node apparently? //t.equal(byteSize('Hello World'), 11, 'Works for text'); //t.equal(byteSize('😀'), 4, 'Works for emojis'); diff --git a/test/converge/converge.js b/test/converge/converge.js index 546dd65b6..292fee1e1 100644 --- a/test/converge/converge.js +++ b/test/converge/converge.js @@ -1,3 +1,2 @@ -const converge = (converger, fns) => (...args) => -converger(...fns.map(fn => fn.apply(null, args))); +const converge = (converger, fns) => (...args) => converger(...fns.map(fn => fn.apply(null, args))); module.exports = converge; \ No newline at end of file diff --git a/test/testlog b/test/testlog index e7ce95fc5..f709c9883 100644 --- a/test/testlog +++ b/test/testlog @@ -1,4 +1,4 @@ -Test log for: Wed Feb 07 2018 12:22:33 GMT+0200 (GTB Standard Time) +Test log for: Wed Feb 07 2018 16:35:36 GMT+0200 (GTB Standard Time) > 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code > tape test/**/*.test.js | tap-spec @@ -88,6 +88,9 @@ Test log for: Wed Feb 07 2018 12:22:33 GMT+0200 (GTB Standard Time) Testing byteSize √ byteSize is a Function + √ Works for a single letter + √ Works for a common string + √ Works for emoji Testing call @@ -1746,8 +1749,8 @@ Test log for: Wed Feb 07 2018 12:22:33 GMT+0200 (GTB Standard Time) √ Works with multiple promises - total: 844 - passing: 844 + total: 847 + passing: 847 duration: 2.4s