@@ -86,6 +86,21 @@ var pointersAndRelationsSchema = {
86
86
classLevelPermissions : defaultClassLevelPermissions
87
87
}
88
88
89
+ const userSchema = {
90
+ "className" : "_User" ,
91
+ "fields" : {
92
+ "objectId" : { "type" : "String" } ,
93
+ "createdAt" : { "type" : "Date" } ,
94
+ "updatedAt" : { "type" : "Date" } ,
95
+ "ACL" : { "type" : "ACL" } ,
96
+ "username" : { "type" : "String" } ,
97
+ "password" : { "type" : "String" } ,
98
+ "email" : { "type" : "String" } ,
99
+ "emailVerified" : { "type" : "Boolean" }
100
+ } ,
101
+ "classLevelPermissions" : defaultClassLevelPermissions ,
102
+ }
103
+
89
104
var noAuthHeaders = {
90
105
'X-Parse-Application-Id' : 'test' ,
91
106
} ;
@@ -139,13 +154,13 @@ describe('schemas', () => {
139
154
} ) ;
140
155
} ) ;
141
156
142
- it ( 'responds with empty list when there are no schemas ' , done => {
157
+ it ( 'creates _User schema when server starts ' , done => {
143
158
request . get ( {
144
159
url : 'http://localhost:8378/1/schemas' ,
145
160
json : true ,
146
161
headers : masterKeyHeaders ,
147
162
} , ( error , response , body ) => {
148
- expect ( body . results ) . toEqual ( [ ] ) ;
163
+ expect ( dd ( body . results , [ userSchema ] ) ) . toEqual ( ) ;
149
164
done ( ) ;
150
165
} ) ;
151
166
} ) ;
@@ -165,9 +180,9 @@ describe('schemas', () => {
165
180
headers : masterKeyHeaders ,
166
181
} , ( error , response , body ) => {
167
182
var expected = {
168
- results : [ plainOldDataSchema , pointersAndRelationsSchema ]
183
+ results : [ userSchema , plainOldDataSchema , pointersAndRelationsSchema ]
169
184
} ;
170
- expect ( body ) . toEqual ( expected ) ;
185
+ expect ( dd ( body , expected ) ) . toEqual ( undefined ) ;
171
186
done ( ) ;
172
187
} )
173
188
} ) ;
@@ -328,31 +343,43 @@ describe('schemas', () => {
328
343
329
344
it ( 'responds with all fields when getting incomplete schema' , done => {
330
345
config . database . loadSchema ( )
331
- . then ( schemaController => schemaController . addClassIfNotExists ( '_User ' , { } , defaultClassLevelPermissions ) )
346
+ . then ( schemaController => schemaController . addClassIfNotExists ( '_Installation ' , { } , defaultClassLevelPermissions ) )
332
347
. then ( ( ) => {
333
348
request . get ( {
334
- url : 'http://localhost:8378/1/schemas/_User ' ,
349
+ url : 'http://localhost:8378/1/schemas/_Installation ' ,
335
350
headers : masterKeyHeaders ,
336
351
json : true
337
352
} , ( error , response , body ) => {
338
- expect ( body ) . toEqual ( {
339
- className : '_User ' ,
353
+ expect ( dd ( body , {
354
+ className : '_Installation ' ,
340
355
fields : {
341
356
objectId : { type : 'String' } ,
342
357
updatedAt : { type : 'Date' } ,
343
358
createdAt : { type : 'Date' } ,
344
- username : { type : 'String' } ,
345
- password : { type : 'String' } ,
346
- authData : { type : 'Object' } ,
347
- email : { type : 'String' } ,
348
- emailVerified : { type : 'Boolean' } ,
359
+ installationId : { type : 'String' } ,
360
+ deviceToken : { type : 'String' } ,
361
+ channels : { type : 'Array' } ,
362
+ deviceType : { type : 'String' } ,
363
+ pushType : { type : 'String' } ,
364
+ GCMSenderId : { type : 'String' } ,
365
+ timeZone : { type : 'String' } ,
366
+ badge : { type : 'Number' } ,
367
+ appIdentifier : { type : 'String' } ,
368
+ localeIdentifier : { type : 'String' } ,
369
+ appVersion : { type : 'String' } ,
370
+ appName : { type : 'String' } ,
371
+ parseVersion : { type : 'String' } ,
349
372
ACL : { type : 'ACL' }
350
373
} ,
351
374
classLevelPermissions : defaultClassLevelPermissions
352
- } ) ;
375
+ } ) ) . toBeUndefined ( ) ;
353
376
done ( ) ;
354
377
} ) ;
355
378
} )
379
+ . catch ( error => {
380
+ fail ( JSON . stringify ( error ) )
381
+ done ( ) ;
382
+ } ) ;
356
383
} ) ;
357
384
358
385
it ( 'lets you specify class name in both places' , done => {
@@ -634,43 +661,41 @@ describe('schemas', () => {
634
661
}
635
662
}
636
663
} , ( error , response , body ) => {
637
- expect ( body ) . toEqual ( {
664
+ expect ( dd ( body , {
638
665
className : '_User' ,
639
666
fields : {
640
667
objectId : { type : 'String' } ,
641
668
updatedAt : { type : 'Date' } ,
642
669
createdAt : { type : 'Date' } ,
643
670
username : { type : 'String' } ,
644
671
password : { type : 'String' } ,
645
- authData : { type : 'Object' } ,
646
672
email : { type : 'String' } ,
647
673
emailVerified : { type : 'Boolean' } ,
648
674
newField : { type : 'String' } ,
649
675
ACL : { type : 'ACL' }
650
676
} ,
651
677
classLevelPermissions : defaultClassLevelPermissions
652
- } ) ;
678
+ } ) ) . toBeUndefined ( ) ;
653
679
request . get ( {
654
680
url : 'http://localhost:8378/1/schemas/_User' ,
655
681
headers : masterKeyHeaders ,
656
682
json : true
657
683
} , ( error , response , body ) => {
658
- expect ( body ) . toEqual ( {
684
+ expect ( dd ( body , {
659
685
className : '_User' ,
660
686
fields : {
661
687
objectId : { type : 'String' } ,
662
688
updatedAt : { type : 'Date' } ,
663
689
createdAt : { type : 'Date' } ,
664
690
username : { type : 'String' } ,
665
691
password : { type : 'String' } ,
666
- authData : { type : 'Object' } ,
667
692
email : { type : 'String' } ,
668
693
emailVerified : { type : 'Boolean' } ,
669
694
newField : { type : 'String' } ,
670
695
ACL : { type : 'ACL' }
671
696
} ,
672
697
classLevelPermissions : defaultClassLevelPermissions
673
- } ) ;
698
+ } ) ) . toBeUndefined ( ) ;
674
699
done ( ) ;
675
700
} ) ;
676
701
} ) ;
@@ -1541,14 +1566,13 @@ describe('schemas', () => {
1541
1566
setPermissionsOnClass ( '_User' , {
1542
1567
'create' : { '*' : true } ,
1543
1568
'addField' : { }
1544
- } ) . then ( ( ) => {
1569
+ } , true ) . then ( ( ) => {
1545
1570
return Parse . User . signUp ( 'foo' , 'bar' ) ;
1546
1571
} ) . then ( ( user ) => {
1547
1572
expect ( user . getUsername ( ) ) . toBe ( 'foo' ) ;
1548
1573
done ( )
1549
- } , ( err ) => {
1550
- console . error ( err ) ;
1551
- fail ( 'should create user' ) ;
1574
+ } , error => {
1575
+ fail ( JSON . stringify ( error ) ) ;
1552
1576
done ( ) ;
1553
1577
} )
1554
1578
} )
0 commit comments