@@ -48,4 +48,52 @@ describe('legacy_wrappers/gridfs.js', () => {
4848 LegacyGridFSBucketWriteStream
4949 ) ;
5050 } ) ;
51+
52+ context ( 'delete' , function ( ) {
53+ it ( 'correctly handles parameters when options are provided' , function ( ) {
54+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'delete' ) ;
55+ const opts = { timeoutMS : 10 } ;
56+ const oid = new mongodbDriver . ObjectId ( ) ;
57+ bucket . delete ( oid , opts , ( ) => { } ) ;
58+ expect ( spy ) . to . be . calledWithExactly ( oid , opts ) ;
59+ } ) ;
60+ it ( 'correctly handles parameters when options are not provided' , function ( ) {
61+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'delete' ) ;
62+ const oid = new mongodbDriver . ObjectId ( ) ;
63+ bucket . delete ( oid , ( ) => { } ) ;
64+ expect ( spy ) . to . be . calledWithExactly ( oid , undefined ) ;
65+ } ) ;
66+ } ) ;
67+
68+ context ( 'rename' , function ( ) {
69+ it ( 'correctly handles parameters when options are provided' , function ( ) {
70+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'rename' ) ;
71+ const opts = { timeoutMS : 10 } ;
72+ const oid = new mongodbDriver . ObjectId ( ) ;
73+ bucket . rename ( oid , 'name' , opts , ( ) => { } ) ;
74+ expect ( spy ) . to . be . calledWithExactly ( oid , 'name' , opts ) ;
75+ } ) ;
76+
77+ it ( 'correctly handles parameters when options are not provided' , function ( ) {
78+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'rename' ) ;
79+ const oid = new mongodbDriver . ObjectId ( ) ;
80+ bucket . rename ( oid , 'name' , ( ) => { } ) ;
81+ expect ( spy ) . to . be . calledWithExactly ( oid , 'name' , undefined ) ;
82+ } ) ;
83+ } ) ;
84+
85+ context ( 'drop' , function ( ) {
86+ it ( 'correctly handles parameters when options are provided' , function ( ) {
87+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'drop' ) ;
88+ const opts = { timeoutMS : 10 } ;
89+ bucket . drop ( opts , ( ) => { } ) ;
90+ expect ( spy ) . to . be . calledWithExactly ( opts ) ;
91+ } ) ;
92+
93+ it ( 'correctly handles parameters when options are not provided' , function ( ) {
94+ const spy = sinon . spy ( mongodbDriver . GridFSBucket . prototype , 'drop' ) ;
95+ bucket . drop ( ( ) => { } ) ;
96+ expect ( spy ) . to . be . calledWithExactly ( undefined ) ;
97+ } ) ;
98+ } ) ;
5199} ) ;
0 commit comments