Test cleanup and fixes [q-r]
This commit is contained in:
@ -1,23 +1,21 @@
|
||||
const expect = require('expect');
|
||||
const reducedFilter = require('./reducedFilter.js');
|
||||
|
||||
|
||||
test('reducedFilter is a Function', () => {
|
||||
test('reducedFilter is a Function', () => {
|
||||
expect(reducedFilter).toBeInstanceOf(Function);
|
||||
});
|
||||
const data = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'john',
|
||||
age: 24
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'mike',
|
||||
age: 50
|
||||
}
|
||||
];
|
||||
test('Filter an array of objects based on a condition while also filtering out unspecified keys.', () => {
|
||||
expect(reducedFilter(data, ['id', 'name'], item => item.age > 24), [{ id: 2).toEqual(name: 'mike'}])
|
||||
const data = [
|
||||
{
|
||||
id: 1,
|
||||
name: 'john',
|
||||
age: 24
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: 'mike',
|
||||
age: 50
|
||||
}
|
||||
];
|
||||
test('Filter an array of objects based on a condition while also filtering out unspecified keys.', () => {
|
||||
expect(reducedFilter(data, ['id', 'name'], item => item.age > 24)).toEqual([{ id: 2, name: 'mike'}])
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user