loopbackio / loopbackio/loopback-next

Test examples with REST datasource (stub provider)

Open
#2,185 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Docs good first issue
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.