Skip to content

Commit 31b70bc

Browse files
committed
fix flaky tests
1 parent 2118a19 commit 31b70bc

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

spec/ParseGraphQLSchema.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ describe('ParseGraphQLSchema', () => {
5353
it('should cache schema', async () => {
5454
const graphQLSchema = await parseGraphQLSchema.load();
5555
const updatedGraphQLSchema = await parseGraphQLSchema.load();
56-
expect(graphQLSchema).toBe(updatedGraphQLSchema);
56+
expect(graphQLSchema).toEqual(updatedGraphQLSchema);
5757
await new Promise(resolve => setTimeout(resolve, 200));
58-
expect(graphQLSchema).toBe(await parseGraphQLSchema.load());
58+
expect(graphQLSchema).toEqual(await parseGraphQLSchema.load());
5959
});
6060

6161
it('should load a brand new GraphQL Schema if Parse Schema changes', async () => {

spec/ParseQuery.spec.js

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,32 +275,26 @@ describe('Parse.Query testing', () => {
275275
});
276276
});
277277

278-
it('query with limit equal to maxlimit', function (done) {
278+
it('query with limit equal to maxlimit', async () => {
279279
const baz = new TestObject({ foo: 'baz' });
280280
const qux = new TestObject({ foo: 'qux' });
281-
reconfigureServer({ maxLimit: 1 });
282-
Parse.Object.saveAll([baz, qux]).then(function () {
283-
const query = new Parse.Query(TestObject);
284-
query.limit(1);
285-
query.find().then(function (results) {
286-
equal(results.length, 1);
287-
done();
288-
});
289-
});
281+
await reconfigureServer({ maxLimit: 1 });
282+
await Parse.Object.saveAll([baz, qux]);
283+
const query = new Parse.Query(TestObject);
284+
query.limit(1);
285+
const results = await query.find();
286+
equal(results.length, 1);
290287
});
291288

292-
it('query with limit exceeding maxlimit', function (done) {
289+
it('query with limit exceeding maxlimit', async () => {
293290
const baz = new TestObject({ foo: 'baz' });
294291
const qux = new TestObject({ foo: 'qux' });
295-
reconfigureServer({ maxLimit: 1 });
296-
Parse.Object.saveAll([baz, qux]).then(function () {
297-
const query = new Parse.Query(TestObject);
298-
query.limit(2);
299-
query.find().then(function (results) {
300-
equal(results.length, 1);
301-
done();
302-
});
303-
});
292+
await reconfigureServer({ maxLimit: 1 });
293+
await Parse.Object.saveAll([baz, qux]);
294+
const query = new Parse.Query(TestObject);
295+
query.limit(2);
296+
const results = await query.find();
297+
equal(results.length, 1);
304298
});
305299

306300
it('containedIn object array queries', function (done) {

0 commit comments

Comments
 (0)