|
| 1 | +'use strict'; |
| 2 | + |
1 | 3 | var Parse = require('parse/node').Parse;
|
2 | 4 | var request = require('request');
|
3 | 5 | var dd = require('deep-diff');
|
@@ -711,28 +713,35 @@ describe('schemas', () => {
|
711 | 713 | }, (error, response, body) => {
|
712 | 714 | expect(response.statusCode).toEqual(200);
|
713 | 715 | expect(response.body).toEqual({});
|
714 |
| - config.database.adapter.database.collection('test__Join:aRelation:MyOtherClass', { strict: true }, (err, coll) => { |
715 |
| - //Expect Join table to be gone |
716 |
| - expect(err).not.toEqual(null); |
717 |
| - config.database.adapter.database.collection('test_MyOtherClass', { strict: true }, (err, coll) => { |
718 |
| - // Expect data table to be gone |
719 |
| - expect(err).not.toEqual(null); |
720 |
| - request.get({ |
721 |
| - url: 'http://localhost:8378/1/schemas/MyOtherClass', |
722 |
| - headers: masterKeyHeaders, |
723 |
| - json: true, |
724 |
| - }, (error, response, body) => { |
725 |
| - //Expect _SCHEMA entry to be gone. |
726 |
| - expect(response.statusCode).toEqual(400); |
727 |
| - expect(body.code).toEqual(Parse.Error.INVALID_CLASS_NAME); |
728 |
| - expect(body.error).toEqual('class MyOtherClass does not exist'); |
729 |
| - done(); |
730 |
| - }); |
| 716 | + config.database.collectionExists('_Join:aRelation:MyOtherClass').then(exists => { |
| 717 | + if (exists) { |
| 718 | + fail('Relation collection should be deleted.'); |
| 719 | + done(); |
| 720 | + } |
| 721 | + return config.database.collectionExists('MyOtherClass'); |
| 722 | + }).then(exists => { |
| 723 | + if (exists) { |
| 724 | + fail('Class collection should be deleted.'); |
| 725 | + done(); |
| 726 | + } |
| 727 | + }).then(() => { |
| 728 | + request.get({ |
| 729 | + url: 'http://localhost:8378/1/schemas/MyOtherClass', |
| 730 | + headers: masterKeyHeaders, |
| 731 | + json: true, |
| 732 | + }, (error, response, body) => { |
| 733 | + //Expect _SCHEMA entry to be gone. |
| 734 | + expect(response.statusCode).toEqual(400); |
| 735 | + expect(body.code).toEqual(Parse.Error.INVALID_CLASS_NAME); |
| 736 | + expect(body.error).toEqual('class MyOtherClass does not exist'); |
| 737 | + done(); |
731 | 738 | });
|
732 | 739 | });
|
733 | 740 | });
|
| 741 | + }).then(() => { |
734 | 742 | }, error => {
|
735 | 743 | fail(error);
|
| 744 | + done(); |
736 | 745 | });
|
737 | 746 | });
|
738 | 747 | });
|
0 commit comments