Skip to content

Commit

Permalink
add example tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Rasmussen committed Nov 27, 2015
1 parent cd1f9a7 commit ecfc44e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/examples.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('examples.spec.js', function() {
);
});

it('array', function() {
it('Array', function() {
expect(dotProp.set([{ bar: 'gold-unicorn'}, 'white-unicorn', 'silver-unicorn'], '0.bar', 'platin-unicorn')).to.eql(
[{ bar: 'platin-unicorn'}, 'white-unicorn', 'silver-unicorn']
);
Expand All @@ -122,4 +122,19 @@ describe('examples.spec.js', function() {
);
});
});

describe('when delete', function() {

it('Array element', function() {
expect(dotProp.delete({foo: [{ bar: 'gold-unicorn'}, 'white-unicorn', 'silver-unicorn']}, 'foo.$end')).to.eql(
{foo: [{ bar: 'gold-unicorn'}, 'white-unicorn']}
);
});

it('Deep prop', function() {
expect(dotProp.delete({foo: [{ bar: 'gold-unicorn'}, 'white-unicorn', 'silver-unicorn']}, 'foo.0.bar')).to.eql(
{foo: [{}, 'white-unicorn', 'silver-unicorn']}
);
});
});
});

0 comments on commit ecfc44e

Please sign in to comment.