Skip to content

Commit a628b69

Browse files
committed
Move the new test under integration/
1 parent 7b8a66a commit a628b69

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

integration/test/ParseObjectTest.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,20 @@ describe('Parse Object', () => {
401401
assert.equal(result.get('objectField').number, 20);
402402
});
403403

404+
it('can set non existing nested fields to objects', async () => {
405+
const o = new Parse.Object('Person');
406+
expect(o.attributes).toEqual({});
407+
o.set('data', {});
408+
await o.save();
409+
expect(o.get('data')).toEqual({});
410+
o.set('data.a', {});
411+
await o.save();
412+
expect(o.get('data')).toEqual({ a: {} });
413+
o.set('data.a.b', {});
414+
await o.save();
415+
expect(o.get('data')).toEqual({ a: { b: {} } });
416+
});
417+
404418
it('can set non existing fields', async () => {
405419
const obj = new TestObject();
406420
obj.set('objectField', { number: 5 });

src/__tests__/ParseObject-test.js

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -465,45 +465,6 @@ describe('ParseObject', () => {
465465
expect(o.attributes).toEqual({ name: 'William', behavior: 'formal' });
466466
});
467467

468-
it('can set nested fields', async () => {
469-
// Mock XHR
470-
CoreManager.getRESTController()._setXHR(
471-
mockXHR([
472-
{
473-
status: 200,
474-
response: { objectId: 'yolo' },
475-
},
476-
])
477-
);
478-
const o = new ParseObject('Person');
479-
expect(o.attributes).toEqual({});
480-
o.set('data', {});
481-
await o.save();
482-
expect(o.get('data')).toEqual({});
483-
o.set('data.a', {});
484-
CoreManager.getRESTController()._setXHR(
485-
mockXHR([
486-
{
487-
status: 200,
488-
response: {},
489-
},
490-
])
491-
);
492-
await o.save();
493-
expect(o.get('data')).toEqual({ a: {} });
494-
o.set('data.a.b', {});
495-
CoreManager.getRESTController()._setXHR(
496-
mockXHR([
497-
{
498-
status: 200,
499-
response: {},
500-
},
501-
])
502-
);
503-
await o.save();
504-
expect(o.get('data')).toEqual({ a: { b: {} } });
505-
});
506-
507468
it('can set id with the objectId attribute', () => {
508469
const o = new ParseObject('Person');
509470
expect(o.attributes).toEqual({});

0 commit comments

Comments
 (0)