'use strict';
/* globals describe, it */

var assert = require('assert');
var get = require('../');
var isPlainObject = require('lodash.isplainobject');



describe('get', function(){
  var o = { a: 'a', b: 'b', c: { c1: 'c1', c2: 'c2' } };

  it('returns the original object if path lookup completely fails', function(){
    assert.equal(get('d', o), o);
  });

  it('returns the last successful value if path lookup partially succeeds and then fails', function(){
    assert.equal(get('c.c3', o), o.c);
  });

  it('returns an empty object if given object isn\'t actually an object', function(){
    assert(isPlainObject(get('foobar', 5)));
  });

  it('accesses a path given as string with keys separated by dots', function(){
    assert.equal(get('c.c2', o), 'c2');
  });

  it('is curried', function(){
    // Redo the above tests in curreid form.
    assert.equal(get('d')(o), o);
    assert.equal(get('c.c3')(o), o.c);
    assert(isPlainObject(get('foobar')(5)));
    assert.equal(get('c.c2')(o), 'c2');
  });

});
@@ -253,20 +253,13 @@
 rns 
-the original
+given
  obj
@@ -281,16 +281,13 @@
 kup 
-complete
+total
 ly f
@@ -364,27 +364,18 @@
 rns 
-the 
 last 
-successful
+found
  val
@@ -504,23 +504,10 @@
 rns 
-an empty object
+%7B%7D
  if 
@@ -621,34 +621,95 @@
 it('
-accesses a path given
+path as String', function()%7B%0A    assert.equal(get('b', o), 'b');%0A  %7D);%0A%0A  it('path
  as 
-s
+S
 trin
@@ -809,18 +809,24 @@
 it('
-is curried
+path as %5BString%5D
 ', f
@@ -844,166 +844,86 @@
     
-// Redo the above tests in curreid form.%0A    assert.equal(get('d')(o), o);%0A    assert.equal(get('c.c3')(o), o.c);%0A    asser
+assert.equal(get(%5B'c', 'c2'%5D, o), 'c2');%0A  %7D);%0A%0A  i
 t(
+'
 is
-PlainObject(get('foobar')(5)));
+ curried', function()%7B
 %0A   
@@ -945,23 +945,17 @@
 et('
-c.c2
+d
 ')(o), 
-'c2'
+o
 );%0A 

Add tests using array for path