-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
34 lines (29 loc) · 938 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*!
* object.filter <https://github.com/jonschlinkert/object.filter>
*
* Copyright (c) 2014 Jon Schlinkert, contributors.
* Licensed under the MIT License
*/
'use strict';
var should = require('should');
var filter = require('./');
describe('.filter()', function () {
it('should return values for which the callback returns true.', function () {
var o = filter({a: 'a', b: 'b', c: 'c'}, function (value, key) {
return key === 'b';
});
o.should.eql({ b: 'b' });
});
it('should omit values for which the callback returns false.', function () {
var o = filter({a: 'a', b: 'b', c: 'c'}, function (value, key) {
return key !== 'b';
});
o.should.eql({a: 'a', c: 'c'});
});
it('should return an empty object if all values return false.', function () {
var o = filter({a: 'a', b: 'b', c: 'c'}, function (value, key) {
return key === 'foo';
});
o.should.eql({});
});
});