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

fix(platform-fastify): adds missing chaining API types for LightMyRequest inject() #5628

Merged

Conversation

squareloop1
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

If we currently use inject() from LightMyRequest to test the application we need to call it like this:

const response = await app.inject({ method: 'POST', url: '/login', payload: loginPayload });

If we try to use the chaining API we are getting TypeScript errors like TS2554: Expected 1 arguments, but got 0. because of missing types.

What is the new behavior?

With the chaining API (https://github.com/fastify/light-my-request#method-chaining) we can also call it in a fluent style like this:

const response = await app.inject().post('/login').payload(loginPayload).end()

Types for this were missing, this PR adds the missing types to be able to use the chaining API. It also allows a usage which is more in line with other testing libraries like e.g. supertest.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@coveralls
Copy link

coveralls commented Oct 30, 2020

Pull Request Test Coverage Report for Build d391710a-b735-4cea-8768-6147c05fcad8

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.825%

Totals Coverage Status
Change from base Build cf4f5692-9ee1-4371-8130-5c6f9c02faac: 0.0%
Covered Lines: 4929
Relevant Lines: 5198

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec added this to the 7.5.0 milestone Nov 2, 2020
@kamilmysliwiec
Copy link
Member

Thanks!

@kamilmysliwiec kamilmysliwiec merged commit 01345a7 into nestjs:master Nov 2, 2020
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.

3 participants