Files
30-seconds-of-code/test/cleanObj/cleanObj.test.js
Angelos Chalaris 4f1e8b48b6 Test files linted
2018-08-03 10:39:26 +03:00

11 lines
398 B
JavaScript

const expect = require('expect');
const cleanObj = require('./cleanObj.js');
test('cleanObj is a Function', () => {
expect(cleanObj).toBeInstanceOf(Function);
});
const testObj = { a: 1, b: 2, children: { a: 1, b: 2 } };
test('Removes any properties except the ones specified from a JSON object', () => {
expect(cleanObj(testObj, ['a'], 'children')).toEqual({ a: 1, children: { a: 1 } });
});