You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write some unit tests that incorporate gridfs-stream and mockgoose. I have the database mocked out and the connection to gridfs set up as follows:
Content is found from the file with the rStream and the data has a length
.on('data',(data)=>{// data has a length there it is a buffer returned})
Problem
When attempting to retrieve the file from the database by use of the id of the file inserted, I am receiving an error that file with id 5bb62062ac13503388572732 not opened for writing. The file is retrieved from the database however the retrieved file has no length.
Is gridfs-stream compatible with mockgoose or any form of mocking mongoose/mongodb?
Is my configuration of gridfs-stream and/or mockgoose correct for this usage?
Any help would be appreciated thanks.
The text was updated successfully, but these errors were encountered:
@bolencki13 : Did you find the solution yet. I am having the same problem. I am using the gridfs for uploading the content using
await _bucket.UploadFromStreamAsync(data.FileName, source, options);
but dont have idea how we can mock the method. Tried so may things using moq nuget and fake lib to mock but no success yet.
if you find the solution please share.
Info
gridfs-stream
^1.1.1mockgoose
^7.3.5nodejs
v8.11.2Description
I am trying to write some unit tests that incorporate
gridfs-stream
andmockgoose
. I have the database mocked out and the connection to gridfs set up as follows:When inserting a file into the database by use of a stream:
Content is found from the file with the
rStream
and the data has a lengthProblem
When attempting to retrieve the file from the database by use of the id of the file inserted, I am receiving an error that
file with id 5bb62062ac13503388572732 not opened for writing
. The file is retrieved from the database however the retrieved file has no length.Error
Questions
Is
gridfs-stream
compatible withmockgoose
or any form of mocking mongoose/mongodb?Is my configuration of
gridfs-stream
and/ormockgoose
correct for this usage?Any help would be appreciated thanks.
The text was updated successfully, but these errors were encountered: