Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import expect from 'expect';
|
||||
const expect = require('expect');
|
||||
const Blob = class{
|
||||
constructor(s) {
|
||||
return {
|
||||
@ -6,14 +6,13 @@ const Blob = class{
|
||||
};
|
||||
}
|
||||
};
|
||||
// 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);
|
||||
|
||||
test('byteSize is a Function', () => {
|
||||
expect(byteSize).toBeInstanceOf(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');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user