kentcdodds / testing-workshop

A workshop for learning how to test JavaScript applications
http://git.io/testing-workshop
1.36k stars 708 forks source link

mockAxios V3 #101

Closed philippefutureboy closed 5 years ago

philippefutureboy commented 5 years ago

Hi 👋

I'd like to contribute the following version of the mock for axios.

This version enables the axios(config) API, like so:

import axios from 'axios';

axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
});

Let me know if that interests you!

Have a great day ☀️

kentcdodds commented 5 years ago

That sure or not fully featured and would work well, but I prefer to keep the abstraction as simple as needed for the situation, so I don't think we'll make that change. Thanks anyway! Maybe you could make your code an open source package! (Though you may consider checking for existing packages that do the job first).

philippefutureboy commented 5 years ago

Great! Thanks for your answer :)