Skip to content

How to mock different APIs in a test file? #1567

Answered by mcollina
ritvik130 asked this question in Q&A
Discussion options

You must be logged in to vote

You would need to do change your logic to:

const agent = new MockAgent();

agent.disableNetConnect();

setGlobalDispatcher(agent);

// ...in each test..
const mockAgent = agent.get('https://test.ca');

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@ritvik130
Comment options

@ritvik130
Comment options

@mcollina
Comment options

@ritvik130
Comment options

Answer selected by ritvik130
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants