File: test.js

package info (click to toggle)
node-for-own 1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 108 kB
  • sloc: makefile: 4; sh: 2
file content (22 lines) | stat: -rw-r--r-- 525 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';

require('mocha');
var assert = require('assert');
var forOwn = require('./');

describe('forOwn', function() {
  it('should expose keys and values from the given object', function() {
    var obj = {a: 'foo', b: 'bar', c: 'baz'};
    var values = [];
    var keys = [];

    forOwn(obj, function(value, key, o) {
      assert.deepEqual(o, obj);
      keys.push(key);
      values.push(value);
    });

    assert.deepEqual(keys, ['a', 'b', 'c']);
    assert.deepEqual(values, ['foo', 'bar', 'baz']);
  });
});