Skip to content

Commit ae457dd

Browse files
committed
No test for exception on non-sensical parent
1 parent 575851c commit ae457dd

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
@@ -622,6 +622,20 @@ describe('ParseObject', () => {
622622
expect(o._getPendingOps()[0]['data.b']._value).toStrictEqual({ c: 2 });
623623
});
624624

625+
it('throw exception on non-sensical parent (not set)', async () => {
626+
const o = new ParseObject('Person');
627+
o.increment('data', 2);
628+
expect(Object.keys(o._getPendingOps()[0]).length).toBe(1);
629+
630+
try {
631+
o.set('data.a', 3);
632+
expect(true).toBe(false);
633+
} catch (e) {
634+
expect(e.message).toBe('Trying to set sub property on a invalid property (data -> a)');
635+
}
636+
637+
});
638+
625639
it('can clear all fields', () => {
626640
const o = new ParseObject('Person');
627641
o._finishFetch({

0 commit comments

Comments
 (0)