@@ -26,25 +26,27 @@ const snakeize = require('snakeize');
2626import * as stream from 'stream' ;
2727import * as through from 'through2' ;
2828import { Bucket , Channel , Notification } from '../src' ;
29- import { CreateWriteStreamOptions , File , SetFileMetadataOptions } from '../src/file' ;
29+ import { CreateWriteStreamOptions , File , SetFileMetadataOptions , FileOptions } from '../src/file' ;
3030import { PromisifyAllOptions } from '@google-cloud/promisify' ;
3131import * as r from 'request' ;
3232import { GetBucketMetadataCallback , GetFilesOptions , MakeAllFilesPublicPrivateOptions , SetBucketMetadataCallback } from '../src/bucket' ;
3333import { AddAclOptions } from '../src/acl' ;
3434
35+
36+
3537class FakeFile {
3638 calledWith_ : IArguments ;
3739 bucket : Bucket ;
3840 name : string ;
39- options ?: { } ;
41+ options : FileOptions ;
4042 metadata : { } ;
4143 createWriteStream : Function ;
42- isSameFile ?: ( ) => boolean ;
43- constructor ( bucket : Bucket , name : string , options ?: { } ) {
44+ isSameFile = ( ) => false ;
45+ constructor ( bucket : Bucket , name : string , options ?: FileOptions ) {
4446 this . calledWith_ = arguments ;
4547 this . bucket = bucket ;
4648 this . name = name ;
47- this . options = options ;
49+ this . options = options || { } ;
4850 this . metadata = { } ;
4951
5052 this . createWriteStream = ( options : CreateWriteStreamOptions ) => {
@@ -1226,7 +1228,7 @@ describe('Bucket', () => {
12261228
12271229 describe ( 'file' , ( ) => {
12281230 const FILE_NAME = 'remote-file-name.jpg' ;
1229- let file : File ;
1231+ let file : FakeFile ;
12301232 const options = { a : 'b' , c : 'd' } ;
12311233
12321234 beforeEach ( ( ) => {
@@ -2242,7 +2244,7 @@ describe('Bucket', () => {
22422244 encryptionKey : 'key' ,
22432245 kmsKeyName : 'kms-key-name' ,
22442246 } ;
2245- bucket . upload ( filepath , options , ( err : Error , file : File ) => {
2247+ bucket . upload ( filepath , options , ( err : Error , file : FakeFile ) => {
22462248 assert . ifError ( err ) ;
22472249 assert . strictEqual ( file . bucket . name , bucket . name ) ;
22482250 assert . deepStrictEqual ( file . metadata , metadata ) ;
@@ -2259,7 +2261,7 @@ describe('Bucket', () => {
22592261 encryptionKey : 'key' ,
22602262 kmsKeyName : 'kms-key-name' ,
22612263 } ;
2262- bucket . upload ( filepath , options , ( err : Error , file : File ) => {
2264+ bucket . upload ( filepath , options , ( err : Error , file : FakeFile ) => {
22632265 assert . ifError ( err ) ;
22642266 assert . strictEqual ( file . bucket . name , bucket . name ) ;
22652267 assert . strictEqual ( file . name , newFileName ) ;
@@ -2277,7 +2279,7 @@ describe('Bucket', () => {
22772279 encryptionKey : 'key' ,
22782280 kmsKeyName : 'kms-key-name' ,
22792281 } ;
2280- bucket . upload ( filepath , options , ( err : Error , file : File ) => {
2282+ bucket . upload ( filepath , options , ( err : Error , file : FakeFile ) => {
22812283 assert . ifError ( err ) ;
22822284 assert . strictEqual ( file . bucket . name , bucket . name ) ;
22832285 assert . strictEqual ( file . name , newFileName ) ;
@@ -2294,7 +2296,7 @@ describe('Bucket', () => {
22942296 return true ;
22952297 } ;
22962298 const options = { destination : fakeFile } ;
2297- bucket . upload ( filepath , options , ( err : Error , file : File ) => {
2299+ bucket . upload ( filepath , options , ( err : Error , file : FakeFile ) => {
22982300 assert . ifError ( err ) ;
22992301 assert ( file . isSameFile ( ) ) ;
23002302 done ( ) ;
@@ -2307,7 +2309,7 @@ describe('Bucket', () => {
23072309 return true ;
23082310 } ;
23092311 const options = { destination : fakeFile , metadata} ;
2310- bucket . upload ( filepath , options , ( err : Error , file : File ) => {
2312+ bucket . upload ( filepath , options , ( err : Error , file : FakeFile ) => {
23112313 assert . ifError ( err ) ;
23122314 assert ( file . isSameFile ( ) ) ;
23132315 assert . deepStrictEqual ( file . metadata , metadata ) ;
0 commit comments