test.js 819 B

1234567891011121314151617181920212223242526272829
  1. /*!
  2. * omit-key <https://github.com/jonschlinkert/omit-key>
  3. *
  4. * Copyright (c) 2014 Jon Schlinkert, contributors.
  5. * Licensed under the MIT License
  6. */
  7. 'use strict';
  8. var should = require('should');
  9. var omit = require('./');
  10. describe('.omit()', function () {
  11. it('should omit the given key from the object.', function () {
  12. omit({a: 'a', b: 'b', c: 'c'}, 'a').should.eql({ b: 'b', c: 'c' });
  13. });
  14. it('should omit the given keys from the object.', function () {
  15. omit({a: 'a', b: 'b', c: 'c'}, ['a', 'c']).should.eql({ b: 'b' });
  16. });
  17. it('should return the object if no keys are specified.', function () {
  18. omit({a: 'a', b: 'b', c: 'c'}).should.eql({a: 'a', b: 'b', c: 'c'});
  19. });
  20. it('should return an empty object if no object is specified.', function () {
  21. omit().should.eql({});
  22. });
  23. });