@@ -345,6 +345,65 @@ describe('File', () => {
345345 } ) ;
346346
347347 describe ( 'copy' , ( ) => {
348+ describe ( 'depricate `keepAcl`' , ( ) => {
349+ // tslint:disable-next-line: no-any
350+ let STORAGE2 : any ;
351+ // tslint:disable-next-line: no-any
352+ let BUCKET2 : any ;
353+ // tslint:disable-next-line: no-any
354+ let file2 : any ;
355+ beforeEach ( ( ) => {
356+ STORAGE2 = {
357+ createBucket : util . noop ,
358+ request : util . noop ,
359+ // tslint:disable-next-line: no-any
360+ makeAuthenticatedRequest ( req : { } , callback : any ) {
361+ if ( callback ) {
362+ ( callback . onAuthenticated || callback ) ( null , req ) ;
363+ }
364+ } ,
365+ bucket ( name : string ) {
366+ return new Bucket ( this , name ) ;
367+ } ,
368+ } ;
369+ BUCKET2 = new Bucket ( STORAGE , 'bucket-name' ) ;
370+ file2 = new File ( BUCKET , FILE_NAME ) ;
371+ } ) ;
372+
373+ it ( 'should warn if `keepAcl` parameter is passed' , done => {
374+ file . request = util . noop ;
375+
376+ // since --throw-deprication is enabled using try=>catch block
377+ try {
378+ file . copy ( 'newFile' , { keepAcl : 'private' } , assert . ifError ) ;
379+ } catch ( err ) {
380+ assert . strictEqual (
381+ err . message ,
382+ 'keepAcl parameter is not supported and will be removed in the next major'
383+ ) ;
384+ assert . strictEqual ( err . name , 'DeprecationWarning' ) ;
385+ done ( ) ;
386+ }
387+ } ) ;
388+
389+ it ( 'should warn only once `keepAcl` parameter is passed' , done => {
390+ file . request = util . noop ;
391+
392+ // since --throw-deprication is enabled using try=>catch block
393+ try {
394+ file . copy ( 'newFile' , { keepAcl : 'private' } , assert . ifError ) ;
395+ } catch ( err ) {
396+ assert . strictEqual (
397+ err . message ,
398+ 'keepAcl parameter is not supported and will be removed in the next major'
399+ ) ;
400+ assert . strictEqual ( err . name , 'DeprecationWarning' ) ;
401+ }
402+ file2 . copy ( 'newFile2' , { keepAcl : 'private' } , assert . ifError ) ;
403+ done ( ) ;
404+ } ) ;
405+ } ) ;
406+
348407 it ( 'should throw if no destination is provided' , ( ) => {
349408 assert . throws ( ( ) => {
350409 file . copy ( ) ;
0 commit comments