Skip to content

Commit 8a058bc

Browse files
committed
No test for exception on non-sensical parent
1 parent 823f2d9 commit 8a058bc

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/__tests__/ParseObject-test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,20 @@ describe('ParseObject', () => {
628628
expect(o._getPendingOps()[0]['data.b']._value).toStrictEqual({ c: 2 });
629629
});
630630

631+
it('throw exception on non-sensical parent (not set)', async () => {
632+
const o = new ParseObject('Person');
633+
o.increment('data', 2);
634+
expect(Object.keys(o._getPendingOps()[0]).length).toBe(1);
635+
636+
try {
637+
o.set('data.a', 3);
638+
expect(true).toBe(false);
639+
} catch (e) {
640+
expect(e.message).toBe('Trying to set sub property on a invalid property (data -> a)');
641+
}
642+
643+
});
644+
631645
it('can clear all fields', () => {
632646
const o = new ParseObject('Person');
633647
o._finishFetch({

0 commit comments

Comments
 (0)