Fixes issue affecting deleting multiple fields of a Schema (#3735)

This commit is contained in:
Paulo Vítor S Reis
2017-04-23 18:22:55 -03:00
committed by Florent Vilmart
parent 2a5c20376a
commit 5e14147676
3 changed files with 85 additions and 24 deletions

View File

@@ -727,6 +727,47 @@ describe('schemas', () => {
})
});
it('lets you delete multiple fields and check schema', done => {
var simpleOneObject = () => {
var obj = new Parse.Object('SimpleOne');
obj.set('aNumber', 5);
obj.set('aString', 'string');
obj.set('aBool', true);
return obj;
};
simpleOneObject().save()
.then(() => {
request.put({
url: 'http://localhost:8378/1/schemas/SimpleOne',
headers: masterKeyHeaders,
json: true,
body: {
fields: {
aString: {__op: 'Delete'},
aNumber: {__op: 'Delete'},
}
}
}, (error, response, body) => {
expect(body).toEqual({
className: 'SimpleOne',
fields: {
//Default fields
ACL: {type: 'ACL'},
createdAt: {type: 'Date'},
updatedAt: {type: 'Date'},
objectId: {type: 'String'},
//Custom fields
aBool: {type: 'Boolean'},
},
classLevelPermissions: defaultClassLevelPermissions
});
done();
});
});
});
it_exclude_dbs(['postgres'])('lets you delete multiple fields and add fields', done => {
var obj1 = hasAllPODobject();
obj1.save()