MetaMask / MetaMask/fetch-node-details-swift

Unit tests and mocking

Open
#6 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
4
Forks
9
Avg merge
5d 49m
Merged PRs (30d)
1

Description

Theres no way to pass in a `URLSession` into any of the functions or constructors. This is how most libraries expose the ability to mock URL requests so that code can be unit tested.

Is there any other method available to mock requests that i've missed?

If not, please update the library to allow me to pass in my own `URLSession` so I can create my own mocks

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

Locate the library's functions and constructors that create URL requests, then inspect how unit tests are organized and how requests could be mocked. The work is done when callers can provide their own URLSession and tests verify requests through that injected session.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile, networking
Issue type
Feature
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.