Files
30-seconds-of-code/test/byteSize/byteSize.test.js
Angelos Chalaris a59af893bf Migrated tests to jest
Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
2018-06-18 14:18:25 +03:00

20 lines
560 B
JavaScript

import expect from 'expect';
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', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
expect(typeof byteSize === 'function').toBeTruthy();
expect(byteSize('a')).toBe(1);
expect(byteSize('Hello World')).toBe(11);
expect(byteSize('😀')).toBe(4);
});