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

feat(testing): Testing utilities for Marble.js #141

Merged
merged 3 commits into from Jun 12, 2019

Conversation

Projects
None yet
2 participants
@krzysztof-miemiec
Copy link
Contributor

commented Jun 11, 2019

PR Type

What kind of change does this PR introduce?

  • Proxy extracted to a separate package
  • Test improvements for Proxy Server & AWS Lambda
  • Storing responses in collections
  • Ability to test API using @marblejs/testing
  • Autogenerated documentation based on tests
[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[x] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Currently, there is no easy way of generating documentation. I introduced the idea of generating documentation out of tests, which was initially described in linked issue.

Issue Number: #81

What is the new behavior?

You can use createTestApi to create a wrapper for server. It can replace supertest in tests. It let's you query server and collect results that can be easily asserted and stored in documentation. See README.md for details.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@krzysztof-miemiec krzysztof-miemiec requested a review from JozefFlakus Jun 11, 2019

@krzysztof-miemiec krzysztof-miemiec self-assigned this Jun 11, 2019

@krzysztof-miemiec krzysztof-miemiec force-pushed the feat/testing branch 2 times, most recently from 8a5d3b1 to bb98458 Jun 11, 2019

Show resolved Hide resolved packages/core/src/http.interface.ts Outdated
Show resolved Hide resolved packages/middleware-io/src/json-schema.ts Outdated
Show resolved Hide resolved packages/middleware-io/src/json-schema.ts Outdated
Show resolved Hide resolved packages/proxy/package.json
Show resolved Hide resolved packages/proxy/src/spec/serverProxy.spec.ts Outdated
Show resolved Hide resolved packages/testing/src/apiResponse.ts Outdated
Show resolved Hide resolved packages/testing/src/apiResponse.ts Outdated
Show resolved Hide resolved packages/testing/src/schema.helper.ts Outdated
Show resolved Hide resolved packages/testing/src/testProxy.ts Outdated
Show resolved Hide resolved packages/testing/src/testProxy.options.ts Outdated

@krzysztof-miemiec krzysztof-miemiec force-pushed the feat/testing branch from 96946ce to 4ab8d42 Jun 11, 2019

feat(testing): Testing utilities for Marble.js
* Proxy extracted to a separate package
* Test improvements for Proxy Server & AWS Lambda
* Storing responses in collections
* Ability to test API using @marblejs/testing
* Autogenerated documentation based on tests

@krzysztof-miemiec krzysztof-miemiec force-pushed the feat/testing branch from 4ab8d42 to 6b18f44 Jun 11, 2019

@codecov

This comment has been minimized.

Copy link

commented Jun 11, 2019

Codecov Report

Merging #141 into master will decrease coverage by 0.31%.
The diff coverage is 91.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
- Coverage   99.06%   98.75%   -0.32%     
==========================================
  Files         109      119      +10     
  Lines        1286     1447     +161     
  Branches      128      142      +14     
==========================================
+ Hits         1274     1429     +155     
- Misses         10       16       +6     
  Partials        2        2
Impacted Files Coverage Δ
...kages/serverless/src/+awsLambda/awsLambda.types.ts 100% <ø> (ø) ⬆️
packages/core/src/http.interface.ts 100% <ø> (ø) ⬆️
packages/core/src/+internal/index.ts 100% <ø> (ø) ⬆️
...ages/serverless/src/+awsLambda/awsLambdaHandler.ts 100% <ø> (ø) ⬆️
packages/testing/src/testProxy.options.ts 100% <100%> (ø)
packages/middleware-body/src/body.util.ts 100% <100%> (ø) ⬆️
packages/testing/src/schema.helper.ts 100% <100%> (ø)
packages/core/src/response/response.handler.ts 100% <100%> (ø) ⬆️
packages/proxy/src/serverProxy.ts 100% <100%> (ø)
packages/proxy/src/serverProxy.helpers.ts 100% <100%> (ø)
... and 29 more

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 d59c939...3b3f978. Read the comment docs.

@krzysztof-miemiec krzysztof-miemiec force-pushed the feat/testing branch 3 times, most recently from 61d94ac to 35cbf01 Jun 12, 2019

feat(Testing): PR fixes
* Added getContentType to @marblejs/core
* Reusing body parsers from @marblejs/core & @marblejs/middleware-body

@krzysztof-miemiec krzysztof-miemiec force-pushed the feat/testing branch from 35cbf01 to 3b3f978 Jun 12, 2019

@JozefFlakus JozefFlakus merged commit 18cb369 into master Jun 12, 2019

1 of 2 checks passed

codecov/patch 91.58% of diff hit (target 99.06%)
Details
Travis CI - Pull Request Build Passed
Details

@JozefFlakus JozefFlakus deleted the feat/testing branch Jun 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.