Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2595,5 +2595,22 @@ describe('Parse.User testing', () => {
})
});
});
})
});

it_exclude_dbs(['postgres'])('should not fail querying non existing relations', done => {
let user = new Parse.User();
user.set({
username: 'hello',
password: 'world'
})
user.signUp().then(() => {
return Parse.User.current().relation('relation').query().find();
}).then((res) => {
expect(res.length).toBe(0);
done();
}).catch((err) => {
fail(JSON.stringify(err));
done();
});
});
});
4 changes: 2 additions & 2 deletions src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// A database adapter that works with data exported from the hosted
// A database adapter that works with data exported from the hosted
// Parse database.

import intersect from 'intersect';
Expand Down Expand Up @@ -121,7 +121,7 @@ DatabaseController.prototype.loadSchema = function() {
DatabaseController.prototype.redirectClassNameForKey = function(className, key) {
return this.loadSchema().then((schema) => {
var t = schema.getExpectedType(className, key);
if (t.type == 'Relation') {
if (t && t.type == 'Relation') {
return t.targetClass;
} else {
return className;
Expand Down