Skip to content

Commit

Permalink
test(ParseCloudeTest): add case 'retrieve subclass objects'
Browse files Browse the repository at this point in the history
* Test failing with error "Expected 'default' to be 'foo'."
* `jasmine.DEFAULT_TIMEOUT_INTERVAL` was increased to `10000` because the first cases often failed when starting integration testing.

Related to issue parse-community/parse-server#5521
  • Loading branch information
RaschidJFR committed Sep 15, 2019
1 parent 3826fb0 commit d0f48aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions integration/test/ParseCloudTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,37 @@ describe('Parse Cloud', () => {
done();
});
});

it('retrieve subclass objects', async (done) => {
try {

// Register custom class with initial value prop
class MySubclass extends Parse.Object {
constructor(attr) {
super('MySubclass', attr);
if(!attr || !attr.defaultProp) {
this.defaultProp = 'default';
}
}
// get defaultProp() { return this.get('defaultProp'); }
// set defaultProp(val) { this.set('defaultProp', val); }
}
Parse.Object.registerSubclass('MySubclass', MySubclass);

const o = await new MySubclass().save();
let results = await new Parse.Query(MySubclass).find();
expect(results.length).toBe(1);
expect(results[0].defaultProp).toBe('default');
await o.destroy();

await new MySubclass({defaultProp: 'foo'}).save();
results = await new Parse.Query(MySubclass).find();
expect(results.length).toBe(1);
expect(results[0].defaultProp).toBe('foo');

This comment has been minimized.

Copy link
@RaschidJFR

RaschidJFR Sep 15, 2019

Author Owner

Failing with "Expected 'default' to be 'foo'."


done();
} catch(e) {
done.fail(e);
}
});
});
2 changes: 1 addition & 1 deletion integration/test/helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const ParseServer = require('parse-server').ParseServer;

jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
beforeAll((done) => {
const { app } = require('../server');
const httpServer = require('http').createServer(app);
Expand Down

0 comments on commit d0f48aa

Please sign in to comment.