codeforpdx / codeforpdx/PASS

Improve testing mocks to mock network calls

Open
#248 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog enhancement help wanted
Dominant language
JavaScript
Stars
38
Forks
23
Avg merge
11m
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
Currently, our unit tests are based around mocking Inrupt's solid-client library. However, this means that the unit tests have a dependency on solid-client. If we ever update the library, and that update includes breaking changes, our unit tests won't be able to detect them.

Describe the solution you'd like
A better way would be to mock responses to the network calls inrupt itself makes. Most of these are REST calls to prescribed endpoints, based on the linked data platform. Vitest suggests using Mock service worker to do this.

Additional context
The main goal of this issue is to remove the test cases' dependency on any specific implementation of Inrupt's libraries. Even if we remove Inrupt's library entirely, and replace it with something else, our tests should still work.

Another goal is to give me an excuse to learn how the Linked Data Platform works.

Contributor guide

No contributing guide indexed for this repository

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 existing unit tests that mock Inrupt's solid-client library, then review the Vitest mocking guidance and the network endpoints used by the client. Replace implementation-level mocks with network-response mocks, as the issue suggests with Mock Service Worker, and verify the tests no longer depend on Inrupt's library while preserving their coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.