Skip to content

Commit

Permalink
[Test]: add deep key get when not defined on underlying content
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed May 9, 2021
1 parent d9e54be commit 05280f7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,17 @@ describe('Unit | Utility | changeset', () => {
expect((dummyChangeset.users as Array<string>).length).toBe(2);
});

it('#get works if content is undefined for nested key', () => {
const model: Record<string, any> = {};

const c = Changeset(model);
c.set('foo.bar.cat', {
color: 'red'
});
const cat = c.get('foo.bar.cat');
expect(cat.color).toEqual('red');
});

/**
* #set
*/
Expand Down

0 comments on commit 05280f7

Please sign in to comment.