Test migration to jest by hand

Apparently using regular expressions is way easier.
This commit is contained in:
Angelos Chalaris
2018-06-18 15:15:56 +03:00
parent 977949ca61
commit 4f7da1be9b
894 changed files with 5917 additions and 3607 deletions

View File

@ -1,18 +1,19 @@
const expect = require('expect');
const converge = require('./converge.js');
test('Testing converge', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
expect(typeof converge === 'function').toBeTruthy();
test('converge is a Function', () => {
expect(converge).toBeInstanceOf(Function);
});
const average = converge((a, b) => a / b, [
arr => arr.reduce((a, v) => a + v, 0),
arr => arr.length,
]);
expect(average([1, 2, 3, 4, 5, 6, 7])).toBe(4);
t.equal(average([1, 2, 3, 4, 5, 6, 7]), 4, 'Produces the average of the array');
const strangeConcat = converge((a, b) => a + b, [
x => x.toUpperCase(),
x => x.toLowerCase()]
);
expect(strangeConcat('Yodel')).toBe("YODELyodel");
});
t.equal(strangeConcat('Yodel'), "YODELyodel", 'Produces the strange concatenation');