'use strict';

// Load chai
const chai = require('chai');
const expect = chai.expect;

// Load our module
const utils = require('../../../app/lib/utils');

// Nests command line arguments by a character, default colon
describe('Function "nestOptions"', () => {
  
  it('should export a function', () => {
    expect(utils.nestOptions).to.be.a('Function');
  });

  it('should return an object', () => {
    const nestOptionsResult = utils.nestOptions({foo: 'bar'});
    expect(nestOptionsResult).to.be.an('object');
  });

  it('should return a flat object without any items to nest', () => {

  });

  it('should nest a set of values seperated by a colon', () => {

  });

  it('should deeply nest an object with multiple colons', () => {

  });

  it('should allow customisation of the delimiter', () => {

  });

  it('should remove entries starting with an underscore', () => {
    const nestOptionsResult = utils.nestOptions({foo: 'bar', '_baz': 'qux'});
    expect(nestOptionsResult).to.be.an('object')
                             .have.property('foo')
                             .and.not.have.property('_baz');
  });

  it('should return an empty object when given an invalid input type', () => {
    const nestOptionsResult = utils.nestOptions('foo');
    expect(nestOptionsResult).to.be.an('object');
  });

  it('should still produce output when it finds a key collision', () => {

  });

});

@@ -337,17 +337,17 @@
 o.be.a('
-F
+f
 unction'
@@ -388,32 +388,37 @@
 bject', () =%3E %7B%0A
+    %0A
     const nestOp
@@ -460,24 +460,29 @@
 o: 'bar'%7D);%0A
+    %0A
     expect(n
@@ -600,223 +600,1300 @@
 %3E %7B%0A
-%0A  %7D);%0A%0A  it('should nest a set of values seperated by a colon', () =%3E %7B%0A%0A  %7D);%0A%0A  it('should deeply nest an object with multiple colons', () =%3E %7B%0A%0A  %7D);%0A%0A  it('should allow customisation of the delimiter', () =%3E %7B%0A
+    %0A    const nestOptionsResult = utils.nestOptions(%7Bfoo: 'bar', baz: 'qux'%7D);%0A    %0A    expect(nestOptionsResult).to.have.all.keys(%5B'foo', 'baz'%5D);%0A  %7D);%0A%0A  it('should nest a set of values seperated by a colon', () =%3E %7B%0A    %0A    const nestOptionsResult = utils.nestOptions(%7Bfoo: 'bar', 'baz:qux': 'quux'%7D);%0A    %0A    expect(nestOptionsResult).to.have.property('baz')%0A                             .that.is.an('object')%0A                             .that.includes(%7Bqux: 'quux'%7D);%0A  %7D);%0A%0A  it('should deeply nest an object with multiple colons', () =%3E %7B%0A    %0A    const nestOptionsResult = utils.nestOptions(%7Bfoo: 'bar', 'baz:qux:quux': 'quuz', 'baz:qux:corge': 'grault'%7D);%0A    %0A    expect(nestOptionsResult).to.have.property('baz')%0A                             .that.is.an('object')%0A                             .that.has.property('qux')%0A                             .that.is.an('object')%0A                             .that.includes(%7Bquux: 'quuz', corge: 'grault'%7D);%0A  %7D);%0A%0A  it('should allow customisation of the delimiter', () =%3E %7B%0A    %0A    const nestOptionsResult = utils.nestOptions(%7Bfoo: 'bar', 'baz.qux': 'quux'%7D, '.');%0A    %0A    expect(nestOptionsResult).to.have.property('baz')%0A                             .that.is.an('object')%0A                             .that.includes(%7Bqux: 'quux'%7D);
 %0A  %7D
@@ -1954,32 +1954,37 @@
 score', () =%3E %7B%0A
+    %0A
     const nestOp
@@ -2041,24 +2041,29 @@
 ': 'qux'%7D);%0A
+    %0A
     expect(n
@@ -2293,24 +2293,29 @@
 e', () =%3E %7B%0A
+    %0A
     const ne
@@ -2354,24 +2354,29 @@
 ons('foo');%0A
+    %0A
     expect(n
@@ -2494,16 +2494,305 @@
 () =%3E %7B%0A
+    %0A    const nestOptionsResult = utils.nestOptions(%7Bfoo: 'bar', 'foo:bar': 'baz'%7D);%0A    %0A    expect(nestOptionsResult).to.be.an('object')%0A                             .have.property('foo')%0A                             .that.is.a('string')%0A                             .and.equals('bar');
 %0A  %7D);%0A%0A

Complete nest options spec