Merge pull request #826 from ParsePlatform/nlutsenko.schema

Convert Schema.js to ES6 class.
This commit is contained in:
Nikita Lutsenko
2016-03-04 08:54:59 -08:00
2 changed files with 402 additions and 403 deletions

View File

@@ -180,20 +180,18 @@ describe('Schema', () => {
it('will fail to create a class if that class was already created by an object', done => {
config.database.loadSchema()
.then(schema => {
schema.validateObject('NewClass', {foo: 7})
.then(() => {
schema.reload()
.then(schema => schema.addClassIfNotExists('NewClass', {
foo: {type: 'String'}
}))
.catch(error => {
expect(error.code).toEqual(Parse.Error.INVALID_CLASS_NAME);
expect(error.message).toEqual('Class NewClass already exists.');
done();
});
.then(schema => {
schema.validateObject('NewClass', { foo: 7 })
.then(() => schema.reloadData())
.then(() => schema.addClassIfNotExists('NewClass', {
foo: { type: 'String' }
}))
.catch(error => {
expect(error.code).toEqual(Parse.Error.INVALID_CLASS_NAME);
expect(error.message).toEqual('Class NewClass already exists.');
done();
});
});
})
});
it('will resolve class creation races appropriately', done => {