-
Notifications
You must be signed in to change notification settings - Fork 1
/
spec.js
30 lines (24 loc) · 1018 Bytes
/
spec.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
var assert = require('assert');
var except = require('./');
describe('except', function() {
it('returns empty object if first argument is null', function() {
assert.deepEqual(except(null, 'foo'), {});
});
it('removes nothing if no exclude key given', function() {
assert.deepEqual(except({ foo: 1, bar: 2, baz: 3 }, null), { foo: 1, bar: 2, baz: 3 });
});
it('can remove a single property', function() {
assert.deepEqual(except({ foo: 1, bar: 2, baz: 3 }, 'baz'), { foo: 1, bar: 2 });
});
it('can remove several properties', function() {
assert.deepEqual(except({ foo: 1, bar: 2, baz: 3 }, 'foo', 'baz'), { bar: 2 });
});
it('can remove properties given as array', function() {
assert.deepEqual(except({ foo: 1, bar: 2, baz: 3 }, ['foo', 'baz']), { bar: 2 });
});
it('can remove prototype properties', function() {
var Obj = function() {};
Obj.prototype = { foo: 1, bar: 2, baz: 3 };
assert.deepEqual(except(new Obj(), 'bar'), { foo: 1, baz: 3 });
});
});