Skip to content

Commit

Permalink
Merge pull request #826 from ParsePlatform/nlutsenko.schema
Browse files Browse the repository at this point in the history
Convert Schema.js to ES6 class.
  • Loading branch information
nlutsenko committed Mar 4, 2016
2 parents 438e802 + 295d361 commit ab11ef1
Show file tree
Hide file tree
Showing 2 changed files with 399 additions and 400 deletions.
24 changes: 11 additions & 13 deletions spec/Schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
Loading

0 comments on commit ab11ef1

Please sign in to comment.