PG: Updating mixed array test (#5252)

* PG: Updating mixed array test

Currently we can save a mixed array but not update

* build array instead of casting

* fix test

* add recursion
This commit is contained in:
Diamond Lewis
2018-12-18 17:38:05 -06:00
committed by GitHub
parent 7b3da8b744
commit 631b1684e2
2 changed files with 51 additions and 14 deletions

View File

@@ -4589,4 +4589,28 @@ describe('Parse.Query testing', () => {
const results = await query.find();
equal(results[0].get('array'), data2);
});
it('can update mixed array', async () => {
const data1 = [0, 1.1, 'hello world', { foo: 'bar' }];
const data2 = [0, 1, { foo: 'bar' }, [], [1, 2, 'bar']];
const obj1 = new TestObject();
obj1.set('array', data1);
await obj1.save();
equal(obj1.get('array'), data1);
const query = new Parse.Query(TestObject);
query.equalTo('objectId', obj1.id);
const result = await query.first();
equal(result.get('array'), data1);
result.set('array', data2);
equal(result.get('array'), data2);
await result.save();
equal(result.get('array'), data2);
const results = await query.find();
equal(results[0].get('array'), data2);
});
});