@@ -18,7 +18,7 @@ var hasAllPODobject = () => {
18
18
return obj ;
19
19
}
20
20
21
- var expectedResponseForHasAllPOD = {
21
+ var plainOldDataSchema = {
22
22
className : 'HasAllPOD' ,
23
23
fields : {
24
24
//Default fields
@@ -38,7 +38,7 @@ var expectedResponseForHasAllPOD = {
38
38
} ,
39
39
} ;
40
40
41
- var expectedResponseforHasPointersAndRelations = {
41
+ var pointersAndRelationsSchema = {
42
42
className : 'HasPointersAndRelations' ,
43
43
fields : {
44
44
//Default fields
@@ -91,10 +91,7 @@ describe('schemas', () => {
91
91
request . get ( {
92
92
url : 'http://localhost:8378/1/schemas/SomeSchema' ,
93
93
json : true ,
94
- headers : {
95
- 'X-Parse-Application-Id' : 'test' ,
96
- 'X-Parse-REST-API-Key' : 'rest' ,
97
- } ,
94
+ headers : restKeyHeaders ,
98
95
} , ( error , response , body ) => {
99
96
expect ( response . statusCode ) . toEqual ( 401 ) ;
100
97
expect ( body . error ) . toEqual ( 'unauthorized' ) ;
@@ -140,7 +137,7 @@ describe('schemas', () => {
140
137
headers : masterKeyHeaders ,
141
138
} , ( error , response , body ) => {
142
139
var expected = {
143
- results : [ expectedResponseForHasAllPOD , expectedResponseforHasPointersAndRelations ]
140
+ results : [ plainOldDataSchema , pointersAndRelationsSchema ]
144
141
} ;
145
142
expect ( body ) . toEqual ( expected ) ;
146
143
done ( ) ;
@@ -154,12 +151,9 @@ describe('schemas', () => {
154
151
request . get ( {
155
152
url : 'http://localhost:8378/1/schemas/HasAllPOD' ,
156
153
json : true ,
157
- headers : {
158
- 'X-Parse-Application-Id' : 'test' ,
159
- 'X-Parse-Master-Key' : 'test' ,
160
- } ,
154
+ headers : masterKeyHeaders ,
161
155
} , ( error , response , body ) => {
162
- expect ( body ) . toEqual ( expectedResponseForHasAllPOD ) ;
156
+ expect ( body ) . toEqual ( plainOldDataSchema ) ;
163
157
done ( ) ;
164
158
} ) ;
165
159
} ) ;
@@ -171,10 +165,7 @@ describe('schemas', () => {
171
165
request . get ( {
172
166
url : 'http://localhost:8378/1/schemas/HASALLPOD' ,
173
167
json : true ,
174
- headers : {
175
- 'X-Parse-Application-Id' : 'test' ,
176
- 'X-Parse-Master-Key' : 'test' ,
177
- } ,
168
+ headers : masterKeyHeaders ,
178
169
} , ( error , response , body ) => {
179
170
expect ( response . statusCode ) . toEqual ( 400 ) ;
180
171
expect ( body ) . toEqual ( {
@@ -283,6 +274,34 @@ describe('schemas', () => {
283
274
url : 'http://localhost:8378/1/schemas' ,
284
275
headers : masterKeyHeaders ,
285
276
json : true ,
277
+ body : {
278
+ className : "NewClass" ,
279
+ fields : {
280
+ foo : { type : 'Number' } ,
281
+ ptr : { type : 'Pointer' , targetClass : 'SomeClass' }
282
+ }
283
+ }
284
+ } , ( error , response , body ) => {
285
+ expect ( body ) . toEqual ( {
286
+ className : 'NewClass' ,
287
+ fields : {
288
+ ACL : { type : 'ACL' } ,
289
+ createdAt : { type : 'Date' } ,
290
+ updatedAt : { type : 'Date' } ,
291
+ objectId : { type : 'String' } ,
292
+ foo : { type : 'Number' } ,
293
+ ptr : { type : 'Pointer' , targetClass : 'SomeClass' } ,
294
+ }
295
+ } ) ;
296
+ done ( ) ;
297
+ } ) ;
298
+ } ) ;
299
+
300
+ it ( 'lets you specify class name in both places' , done => {
301
+ request . post ( {
302
+ url : 'http://localhost:8378/1/schemas/NewClass' ,
303
+ headers : masterKeyHeaders ,
304
+ json : true ,
286
305
body : {
287
306
className : "NewClass" ,
288
307
}
0 commit comments