{"size": 1022, "ext": "js", "max_stars_repo_path": "node_modules/dot-object/test/dot.js", "max_stars_repo_name": "Clomez/Node-browser-gui-scanner", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "node_modules/dot-object/test/dot.js", "max_issues_repo_name": "Clomez/Node-browser-gui-scanner", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/dot-object/test/dot.js", "max_forks_repo_name": "Clomez/Node-browser-gui-scanner", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.6538461538, "max_line_length": 73, "alphanum_fraction": 0.4931506849}
'use strict'

require('should')
var Dot = require('../index')

describe('dotted-key/value pairs:', function () {
  var obj
  var expected

  beforeEach(function () {
    obj = {
      id: 'my-id',
      nes: {
        ted: {
          value: true
        }
      },
      other: {
        nested: {
          stuff: 5
        }
      },
      some: {
        array: ['A', 'B']
      },
      ehrm: 123,
      dates: {
        first: new Date('Mon Oct 13 2014 00:00:00 GMT+0100 (BST)')
      }
    }

    expected = {
      id: 'my-id',
      'nes.ted.value': true,
      'other.nested.stuff': 5,
      'some.array.0': 'A',
      'some.array.1': 'B',
      ehrm: 123,
      'dates.first': new Date('Mon Oct 13 2014 00:00:00 GMT+0100 (BST)')
    }
  })

  it('Should be able to convert to dotted-key/value pairs', function () {
    Dot.dot(obj).should.eql(expected)
  })

  it('dot() should equal object()', function () {
    var pkg = require('./fixtures/package.json')
    Dot.object(Dot.dot(pkg)).should.eql(pkg)
  })
})
