Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support passing a Readable stream as the stub for S3.GetObject #144

Merged
merged 1 commit into from
Aug 6, 2018

Conversation

jstewmon
Copy link

@jstewmon jstewmon commented Jul 3, 2018

  • swapped tape with tap to get afterEach, so that the sandbox can be
    predictably restored after each test.
    • removed all restore calls that do not test restore feature
  • skipped the test about a stub being returned because that behavior
    only applies when the service constructor has already been called when
    mock is called. the test previously passed due to side effects of
    unrestored sandbox.

fixes #142

@nelsonic
Copy link
Member

nelsonic commented Jul 3, 2018

@jstewmon this PR looks promising! please link to an issue https://github.com/dwyl/aws-sdk-mock/issues for context. thanks! 👍

@codecov
Copy link

codecov bot commented Jul 3, 2018

Codecov Report

Merging #144 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
+ Coverage   99.06%   99.08%   +0.01%     
==========================================
  Files           1        1              
  Lines         107      109       +2     
==========================================
+ Hits          106      108       +2     
  Misses          1        1
Impacted Files Coverage Δ
index.js 99.08% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b101d2...26f3975. Read the comment docs.

@jstewmon jstewmon force-pushed the createReadStream-stream branch 2 times, most recently from 2af6d5d to ff7b0b1 Compare July 3, 2018 21:32
- swapped tape with tap to get afterEach, so that the sandbox can be
  predictably restored after each test.
  - removed all restore calls that do not test restore feature
- skipped the test about a stub being returned because that behavior
  only applies when the service constructor has already been called when
  mock is called. the test previously passed due to side effects of
  unrestored sandbox.
@stephanschubert
Copy link

LGTM?

@nelsonic
Copy link
Member

nelsonic commented Aug 5, 2018

@Jazen do you "second" the need for this issue: #142 ? (thanks!)

@stephanschubert
Copy link

@nelsonic Yes, because the AWS SDK docs say:

All requests made through the SDK are asynchronous and use a callback interface. Each service method that kicks off a request returns an AWS.Request object that you can use to register callbacks.

Example:

var out = fs.createWriteStream('/path/to/outfile.jpg');
s3.service.getObject(params).createReadStream().pipe(out);

Copy link
Member

@nelsonic nelsonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jstewmon thank you for taking the time to prepare this Pull Request
with improvements to both tests & docs! 🎉

@Jazen thanks for confirming. 👍

@nelsonic nelsonic merged commit 0bbb054 into dwyl:master Aug 6, 2018
@nelsonic
Copy link
Member

nelsonic commented Aug 6, 2018

@jstewmon aws-sdk-mock@4.1.0 is now on NPM.
thanks again! 🥇

@lucaslago
Copy link

awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Readable Stream support
4 participants