File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 11// This is a port of the test suite:
22// hungry/js/test/parse_file_test.js
33
4+ "use strict" ;
5+
46var request = require ( 'request' ) ;
57
68var str = "Hello World!" ;
@@ -482,7 +484,22 @@ describe('Parse.File testing', () => {
482484 ) ;
483485 done ( ) ;
484486 } ) ;
485-
486487 } ) ;
487488
489+ it ( 'supports files in objects without urls' , done => {
490+ var file = {
491+ __type : 'File' ,
492+ name : '123.txt'
493+ } ;
494+ var obj = new Parse . Object ( 'FileTest' ) ;
495+ obj . set ( 'file' , file ) ;
496+ obj . save ( ) . then ( ( ) => {
497+ var query = new Parse . Query ( 'FileTest' ) ;
498+ return query . first ( ) ;
499+ } ) . then ( result => {
500+ let fileAgain = result . get ( 'file' ) ;
501+ expect ( fileAgain . url ( ) ) . toMatch ( / 1 2 3 .t x t $ / ) ;
502+ done ( ) ;
503+ } ) ;
504+ } ) ;
488505} ) ;
Original file line number Diff line number Diff line change @@ -728,7 +728,7 @@ function getObjectType(obj) {
728728 if ( obj . __type === 'Pointer' && obj . className ) {
729729 return '*' + obj . className ;
730730 }
731- if ( obj . __type === 'File' && obj . url && obj . name ) {
731+ if ( obj . __type === 'File' && obj . name ) {
732732 return 'file' ;
733733 }
734734 if ( obj . __type === 'Date' && obj . iso ) {
You can’t perform that action at this time.
0 commit comments