Migrated tests to jest

Used jest-codemods to migrate, will have to pass everything by hand before we can merge.
This commit is contained in:
Angelos Chalaris
2018-06-18 14:18:25 +03:00
parent 63ec2596cf
commit a59af893bf
890 changed files with 6950 additions and 6921 deletions

View File

@ -1,24 +1,19 @@
const test = require('tape');
const expect = require('expect');
const collatz = require('./collatz.js');
test('Testing collatz', (t) => {
test('Testing collatz', () => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof collatz === 'function', 'collatz is a Function');
expect(typeof collatz === 'function').toBeTruthy();
//t.deepEqual(collatz(args..), 'Expected');
t.equal(collatz(8), 4, 'When n is even, divide by 2');
t.equal(collatz(9), 28, 'When n is odd, times by 3 and add 1');
expect(collatz(8)).toBe(4);
expect(collatz(9)).toBe(28);
let n = 9;
while(true){
if (n === 1){
t.pass('Eventually reaches 1');
break;
}
n = collatz(n);
}
//t.false(collatz(args..), 'Expected');
//t.throws(collatz(args..), 'Expected');
t.end();
});