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

RFC: Add unmock to cloud.spec.browser.ts. #273

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ksaaskil
Copy link

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Request for comments on a new testing library that could replace nock in testing HTTP traffic.

  • What is the current behavior? (You can also link to an open issue here)

Tests in cloud.spec.browser.ts define a nock scope for every endpoint separately.

  • What is the new behavior (if this is a feature change)?

Unmock intercepts all traffic by default and relies on service specification (like OpenAPI) to verify requests and serve back mock data.

  • Other information:

Hi!
I'm one of the authors of unmock.io, a new open-source API testing library that I'm building with some colleagues. We are looking for repos where we feel unmock could reduce lines of code and increase clarity, and we thought that yours might be a good candidate.

The idea of unmock is that you drop in your service contract like an OpenAPI, Swagger, or RAML specification, and unmock then intercepts traffic and serves back semantically correct mock data for the service hit with request. I could not find any specification for cloud.filestackapi.com so I created a mock spec from scratch for the testing purposes. If such a specification existed, one could drop all the nock scope mocks for different endpoints and rely on the spec to (1) verify outgoing requests are valid and (2) be served back data of correct type so the handling of responses can be tested.

It'd be great if you could check out the PR and give us your thoughts - we hope you like it!

* Add unmock to a single file.

* Clean-up.

* Clean spec.
@ksaaskil ksaaskil changed the title Add unmock to cloud.spec.browser.ts. (#1) RFC: Add unmock to cloud.spec.browser.ts. Aug 16, 2019
@pcholuj pcholuj self-assigned this Aug 19, 2019
@codecov
Copy link

codecov bot commented Aug 19, 2019

Codecov Report

Merging #273 into master will decrease coverage by 0.13%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #273      +/-   ##
==========================================
- Coverage    99.1%   98.96%   -0.14%     
==========================================
  Files          32       32              
  Lines        1456     1456              
  Branches      210      270      +60     
==========================================
- Hits         1443     1441       -2     
- Misses         13       15       +2
Impacted Files Coverage Δ
src/lib/api/cloud.ts 89.36% <0%> (-2.13%) ⬇️

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 2952376...bc962a6. Read the comment docs.

@pcholuj
Copy link
Contributor

pcholuj commented Aug 20, 2019

Hi a quite cool tool for testing APIs, I will look into it when I will find some time. Thanks for PR

@pcholuj pcholuj force-pushed the master branch 2 times, most recently from 23394d8 to 30e0038 Compare March 8, 2021 11:39
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.

None yet

2 participants