loopbackio / loopbackio/loopback-next
Test examples with REST datasource (stub provider)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
My controllers are using a service provider that uses a REST datasource. This pulls in data from a remote server and then the controller manipulates this data to send to the client. I'm trying to find the best way to mock the responses from the remotes service in order to test the controller.
The documentation has a section for stub services but it is not currently populated.
https://loopback.io/doc/en/lb4/Testing-your-application.html#create-a-stub-service
Can you please point me in the right direction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked “Create a stub service” section in Testing your application and review the surrounding controller-testing guidance. Document how to mock responses from a remote REST datasource for controller tests, with an example; the section should no longer be unpopulated and should explain how to verify the controller behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, documentation, testing-qa
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100