File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
// This is a port of the test suite:
2
2
// hungry/js/test/parse_file_test.js
3
3
4
+ "use strict" ;
5
+
4
6
var request = require ( 'request' ) ;
5
7
6
8
var str = "Hello World!" ;
@@ -482,7 +484,22 @@ describe('Parse.File testing', () => {
482
484
) ;
483
485
done ( ) ;
484
486
} ) ;
485
-
486
487
} ) ;
487
488
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
+ } ) ;
488
505
} ) ;
Original file line number Diff line number Diff line change @@ -728,7 +728,7 @@ function getObjectType(obj) {
728
728
if ( obj . __type === 'Pointer' && obj . className ) {
729
729
return '*' + obj . className ;
730
730
}
731
- if ( obj . __type === 'File' && obj . url && obj . name ) {
731
+ if ( obj . __type === 'File' && obj . name ) {
732
732
return 'file' ;
733
733
}
734
734
if ( obj . __type === 'Date' && obj . iso ) {
You can’t perform that action at this time.
0 commit comments