Ignores createdAt when update (#3111)
This commit is contained in:
committed by
Florent Vilmart
parent
8f1c1f419b
commit
85567310d4
@@ -420,3 +420,34 @@ describe('rest create', () => {
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('rest update', () => {
|
||||
|
||||
it('ignores createdAt', done => {
|
||||
const nobody = auth.nobody(config);
|
||||
const className = 'Foo';
|
||||
const newCreatedAt = new Date('1970-01-01T00:00:00.000Z');
|
||||
|
||||
rest.create(config, nobody, className, {}).then(res => {
|
||||
const objectId = res.response.objectId;
|
||||
const restObject = {
|
||||
createdAt: {__type: "Date", iso: newCreatedAt}, // should be ignored
|
||||
};
|
||||
|
||||
return rest.update(config, nobody, className, objectId, restObject).then(() => {
|
||||
const restWhere = {
|
||||
objectId: objectId,
|
||||
};
|
||||
return rest.find(config, nobody, className, restWhere, {});
|
||||
});
|
||||
}).then(res2 => {
|
||||
const updatedObject = res2.results[0];
|
||||
expect(new Date(updatedObject.createdAt)).not.toEqual(newCreatedAt);
|
||||
done();
|
||||
}).then(done).catch(err => {
|
||||
fail(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user