Tests for mapKeys, lowercaseKeys

This commit is contained in:
Angelos Chalaris
2018-02-03 13:28:50 +02:00
parent 5676b1428b
commit 61c49fbda0
3 changed files with 13 additions and 5 deletions

View File

@ -5,9 +5,13 @@ test('Testing lowercaseKeys', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof lowercaseKeys === 'function', 'lowercaseKeys is a Function');
const myObj = { Name: 'Adam', sUrnAME: 'Smith' };
const myObjLower = lowercaseKeys(myObj);
t.deepEqual(myObjLower, {name: 'Adam', surname: 'Smith'}, 'Lowercases object keys');
t.deepEqual(myObj, { Name: 'Adam', sUrnAME: 'Smith' }, 'Does not mutate original object');
//t.deepEqual(lowercaseKeys(args..), 'Expected');
//t.equal(lowercaseKeys(args..), 'Expected');
//t.false(lowercaseKeys(args..), 'Expected');
//t.throws(lowercaseKeys(args..), 'Expected');
t.end();
});
});

View File

@ -5,9 +5,10 @@ test('Testing mapKeys', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof mapKeys === 'function', 'mapKeys is a Function');
t.deepEqual(mapKeys({ a: 1, b: 2 }, (val, key) => key + val), { a1: 1, b2: 2 }, 'Maps keys');
//t.deepEqual(mapKeys(args..), 'Expected');
//t.equal(mapKeys(args..), 'Expected');
//t.false(mapKeys(args..), 'Expected');
//t.throws(mapKeys(args..), 'Expected');
t.end();
});
});

View File

@ -1,4 +1,4 @@
Test log for: Sat Feb 03 2018 13:12:08 GMT+0200 (GTB Standard Time)
Test log for: Sat Feb 03 2018 13:28:38 GMT+0200 (GTB Standard Time)
> 30-seconds-of-code@0.0.1 test G:\My Files\git Repositories\30-seconds-of-code
> tape test/**/*.test.js | tap-spec
@ -895,6 +895,8 @@ Test log for: Sat Feb 03 2018 13:12:08 GMT+0200 (GTB Standard Time)
Testing lowercaseKeys
√ lowercaseKeys is a Function
√ Lowercases object keys
√ Does not mutate original object
Testing luhnCheck
@ -906,6 +908,7 @@ Test log for: Sat Feb 03 2018 13:12:08 GMT+0200 (GTB Standard Time)
Testing mapKeys
√ mapKeys is a Function
√ Maps keys
Testing mapObject
@ -1688,8 +1691,8 @@ Test log for: Sat Feb 03 2018 13:12:08 GMT+0200 (GTB Standard Time)
√ Works with multiple promises
total: 792
passing: 792
total: 795
passing: 795
duration: 2.4s