@@ -18,7 +18,7 @@ var hasAllPODobject = () => {
1818 return obj ;
1919}
2020
21- var expectedResponseForHasAllPOD = {
21+ var plainOldDataSchema = {
2222 className : 'HasAllPOD' ,
2323 fields : {
2424 //Default fields
@@ -38,7 +38,7 @@ var expectedResponseForHasAllPOD = {
3838 } ,
3939} ;
4040
41- var expectedResponseforHasPointersAndRelations = {
41+ var pointersAndRelationsSchema = {
4242 className : 'HasPointersAndRelations' ,
4343 fields : {
4444 //Default fields
@@ -91,10 +91,7 @@ describe('schemas', () => {
9191 request . get ( {
9292 url : 'http://localhost:8378/1/schemas/SomeSchema' ,
9393 json : true ,
94- headers : {
95- 'X-Parse-Application-Id' : 'test' ,
96- 'X-Parse-REST-API-Key' : 'rest' ,
97- } ,
94+ headers : restKeyHeaders ,
9895 } , ( error , response , body ) => {
9996 expect ( response . statusCode ) . toEqual ( 401 ) ;
10097 expect ( body . error ) . toEqual ( 'unauthorized' ) ;
@@ -140,7 +137,7 @@ describe('schemas', () => {
140137 headers : masterKeyHeaders ,
141138 } , ( error , response , body ) => {
142139 var expected = {
143- results : [ expectedResponseForHasAllPOD , expectedResponseforHasPointersAndRelations ]
140+ results : [ plainOldDataSchema , pointersAndRelationsSchema ]
144141 } ;
145142 expect ( body ) . toEqual ( expected ) ;
146143 done ( ) ;
@@ -154,12 +151,9 @@ describe('schemas', () => {
154151 request . get ( {
155152 url : 'http://localhost:8378/1/schemas/HasAllPOD' ,
156153 json : true ,
157- headers : {
158- 'X-Parse-Application-Id' : 'test' ,
159- 'X-Parse-Master-Key' : 'test' ,
160- } ,
154+ headers : masterKeyHeaders ,
161155 } , ( error , response , body ) => {
162- expect ( body ) . toEqual ( expectedResponseForHasAllPOD ) ;
156+ expect ( body ) . toEqual ( plainOldDataSchema ) ;
163157 done ( ) ;
164158 } ) ;
165159 } ) ;
@@ -171,10 +165,7 @@ describe('schemas', () => {
171165 request . get ( {
172166 url : 'http://localhost:8378/1/schemas/HASALLPOD' ,
173167 json : true ,
174- headers : {
175- 'X-Parse-Application-Id' : 'test' ,
176- 'X-Parse-Master-Key' : 'test' ,
177- } ,
168+ headers : masterKeyHeaders ,
178169 } , ( error , response , body ) => {
179170 expect ( response . statusCode ) . toEqual ( 400 ) ;
180171 expect ( body ) . toEqual ( {
@@ -283,6 +274,34 @@ describe('schemas', () => {
283274 url : 'http://localhost:8378/1/schemas' ,
284275 headers : masterKeyHeaders ,
285276 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 ,
286305 body : {
287306 className : "NewClass" ,
288307 }
0 commit comments