remove one use of schemaController
This commit is contained in:
@@ -132,7 +132,9 @@ describe('mongoObjectToParseObject', () => {
|
|||||||
|
|
||||||
it('pointer', (done) => {
|
it('pointer', (done) => {
|
||||||
var input = {_p_userPointer: '_User$123'};
|
var input = {_p_userPointer: '_User$123'};
|
||||||
var output = transform.mongoObjectToParseObject(dummySchema, null, input);
|
var output = transform.mongoObjectToParseObject(dummySchema, null, input, {
|
||||||
|
fields: { userPointer: { type: 'Pointer', targetClass: '_User' } },
|
||||||
|
});
|
||||||
expect(typeof output.userPointer).toEqual('object');
|
expect(typeof output.userPointer).toEqual('object');
|
||||||
expect(output.userPointer).toEqual(
|
expect(output.userPointer).toEqual(
|
||||||
{__type: 'Pointer', className: '_User', objectId: '123'}
|
{__type: 'Pointer', className: '_User', objectId: '123'}
|
||||||
@@ -142,7 +144,9 @@ describe('mongoObjectToParseObject', () => {
|
|||||||
|
|
||||||
it('null pointer', (done) => {
|
it('null pointer', (done) => {
|
||||||
var input = {_p_userPointer: null};
|
var input = {_p_userPointer: null};
|
||||||
var output = transform.mongoObjectToParseObject(dummySchema, null, input);
|
var output = transform.mongoObjectToParseObject(dummySchema, null, input, {
|
||||||
|
fields: { userPointer: { type: 'Pointer', targetClass: '_User' } },
|
||||||
|
});
|
||||||
expect(output.userPointer).toBeUndefined();
|
expect(output.userPointer).toBeUndefined();
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -834,7 +834,7 @@ const mongoObjectToParseObject = (schemaController, className, mongoObject, sche
|
|||||||
if (schemaController && schemaController.getExpectedType) {
|
if (schemaController && schemaController.getExpectedType) {
|
||||||
expected = schemaController.getExpectedType(className, newKey);
|
expected = schemaController.getExpectedType(className, newKey);
|
||||||
}
|
}
|
||||||
if (!expected) {
|
if (!schema.fields[newKey]) {
|
||||||
log.info('transform.js',
|
log.info('transform.js',
|
||||||
'Found a pointer column not in the schema, dropping it.',
|
'Found a pointer column not in the schema, dropping it.',
|
||||||
className, newKey);
|
className, newKey);
|
||||||
|
|||||||
Reference in New Issue
Block a user