Mockable functional apis for uni tests
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 1
- Avg merge
- 8m
- Merged PRs (30d)
- 2
Description
There should be a way to simulate mockable APIs with ram stored documents.
We could do something like this:
- put: https://github.com/phcode-dev/extensionService/blob/main/test/unit/utils/sync-test.spec.js#L35
- getFromIndex: https://github.com/phcode-dev/extensionService/blob/main/test/unit/utils/sync-test.spec.js#L53
It might be better to have first-party mock support integrated into the source. For Eg. when initing we could give init(...mockDBMode=true) and the mocks will kick in and can use the simulated in-memory db for unit tests without any code code changes for tests.
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 by reading test/unit/utils/sync-test.spec.js, especially the put and getFromIndex examples linked in the issue, and inspect the init entry point in the library. Define the mock database behavior and integration boundaries before implementing it; done means unit tests can use ram-backed documents through the proposed mock mode without test-specific code changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- databases, testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100