Files
30-seconds-of-code/test/lowercaseKeys/lowercaseKeys.test.js
Angelos Chalaris 4f7da1be9b Test migration to jest by hand
Apparently using regular expressions is way easier.
2018-06-18 15:15:56 +03:00

14 lines
468 B
JavaScript

const expect = require('expect');
const lowercaseKeys = require('./lowercaseKeys.js');
test('lowercaseKeys is a Function', () => {
expect(lowercaseKeys).toBeInstanceOf(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');