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:
@ -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();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user