File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -547,7 +547,7 @@ describe('Parse Object', () => {
547547 } ) ;
548548
549549 it ( 'cannot create invalid key names' , async ( ) => {
550- const error = new Parse . Error ( Parse . Error . INVALID_KEY_NAME , ` Invalid key name: " foo^bar"` ) ;
550+ const error = new Parse . Error ( Parse . Error . INVALID_KEY_NAME , ' Invalid key name: foo^bar' ) ;
551551 const item = new Parse . Object ( 'Item' ) ;
552552 expect ( ( ) => {
553553 item . set ( { 'foo^bar' : 'baz' } ) ;
@@ -559,7 +559,7 @@ describe('Parse Object', () => {
559559 const item = new Parse . Object ( 'Item' ) ;
560560 expect ( ( ) => {
561561 item . set ( { foobar : 'baz' , 'foo^bar' : 'baz' } ) ;
562- } ) . toThrow ( new Parse . Error ( Parse . Error . INVALID_KEY_NAME , ` Invalid key name: " foo^bar"` ) ) ;
562+ } ) . toThrow ( new Parse . Error ( Parse . Error . INVALID_KEY_NAME , ' Invalid key name: foo^bar' ) ) ;
563563 } ) ;
564564
565565 it ( 'can unset fields' , done => {
Original file line number Diff line number Diff line change @@ -1099,8 +1099,8 @@ class ParseObject {
10991099 return new ParseError ( ParseError . OTHER_CAUSE , 'ACL must be a Parse ACL.' ) ;
11001100 }
11011101 for ( const key in attrs ) {
1102- if ( ! / ^ [ A - Z a - z ] [ 0 - 9 A - Z a - z _ . ] * $ / . test ( key ) ) {
1103- return new ParseError ( ParseError . INVALID_KEY_NAME , `Invalid key name: " ${ key } " ` ) ;
1102+ if ( ! / ^ [ A - Z a - z _ ] [ 0 - 9 A - Z a - z _ . ] * $ / . test ( key ) ) {
1103+ return new ParseError ( ParseError . INVALID_KEY_NAME , `Invalid key name: ${ key } ` ) ;
11041104 }
11051105 }
11061106 return false ;
Original file line number Diff line number Diff line change @@ -965,7 +965,7 @@ describe('ParseObject', () => {
965965 o . validate ( {
966966 'invalid!key' : 12 ,
967967 } )
968- ) . toEqual ( new ParseError ( ParseError . INVALID_KEY_NAME , ` Invalid key name: " invalid!key"` ) ) ;
968+ ) . toEqual ( new ParseError ( ParseError . INVALID_KEY_NAME , ' Invalid key name: invalid!key' ) ) ;
969969
970970 expect (
971971 o . validate ( {
@@ -988,7 +988,7 @@ describe('ParseObject', () => {
988988 expect ( o . set ( 'ACL' , { '*' : { read : true , write : false } } ) ) . toBe ( o ) ;
989989 expect ( ( ) => {
990990 o . set ( '$$$' , 'o_O' ) ;
991- } ) . toThrow ( new ParseError ( ParseError . INVALID_KEY_NAME , ` Invalid key name: " $$$"` ) ) ;
991+ } ) . toThrow ( new ParseError ( ParseError . INVALID_KEY_NAME , ' Invalid key name: $$$' ) ) ;
992992 } ) ;
993993
994994 it ( 'ignores validation if ignoreValidation option is passed to set()' , ( ) => {
@@ -1003,6 +1003,8 @@ describe('ParseObject', () => {
10031003 expect ( o . isValid ( ) ) . toBe ( true ) ;
10041004 o . set ( 'someKey' , 'someValue' ) ;
10051005 expect ( o . isValid ( ) ) . toBe ( true ) ;
1006+ o . set ( '_internalField' , 'allow_underscore' ) ;
1007+ expect ( o . isValid ( ) ) . toBe ( true ) ;
10061008 o . _finishFetch ( {
10071009 objectId : 'O3' ,
10081010 'invalid!key' : 'oops' ,
You can’t perform that action at this time.
0 commit comments