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:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user