This repository was archived by the owner on Jan 26, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-17
lines changed Expand file tree Collapse file tree 2 files changed +11
-17
lines changed Original file line number Diff line number Diff line change @@ -65,20 +65,17 @@ function validateColumn(column: string) {
6565}
6666
6767function validateFields ( data ) {
68-
69- function hasMutlipleGeoPoints ( ) {
70- var geoPointCount = 0 ;
71- for ( var prop in data ) {
72- if ( data . hasOwnProperty ( prop ) &&
73- ( data [ prop ] instanceof Parse . GeoPoint ) ) {
74- ++ geoPointCount ;
75- if ( geoPointCount > 1 ) {
76- return true ;
77- }
78- }
68+ // Check for multiple GeoPoints.
69+ var geoPointCount = 0 ;
70+ for ( var prop in data ) {
71+ if ( data . hasOwnProperty ( prop ) &&
72+ ( data [ prop ] instanceof Parse . GeoPoint ) ) {
73+ ++ geoPointCount ;
74+ if ( geoPointCount > 1 ) {
75+ throw Error ( 'There can only be 1 GeoPoint when mutating an object.' ) ;
76+ }
7977 }
80- return false ;
81- } ;
78+ }
8279
8380 if ( data . hasOwnProperty ( 'objectId' ) ) {
8481 warning ( 'Ignoring reserved field: objectId' ) ;
@@ -96,9 +93,6 @@ function validateFields(data) {
9693 warning ( 'Ignoring reserved field: updatedAt' ) ;
9794 delete data . updatedAt ;
9895 }
99- if ( hasMutlipleGeoPoints ( ) ) {
100- throw Error ( 'There can only be 1 GeoPoint when mutating an object.' ) ;
101- }
10296}
10397
10498class Mutation {
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ describe('Mutation Generators', function() {
5555 g1 : new Parse . GeoPoint ( ) ,
5656 g2 : new Parse . GeoPoint ( ) ,
5757 } ) ;
58- } ) . toThrow ( ) ;
58+ } ) . toThrow ( 'There can only be 1 GeoPoint when mutating an object.' ) ;
5959 } ) ;
6060
6161 it ( 'generates an Unset Mutation' , function ( ) {
You can’t perform that action at this time.
0 commit comments