@laura-wert/axios-intercept-mock-adapter
v0.0.2
Published
this is een extension off https://github.com/ctimmerm/axios-mock-adapter
Downloads
4
Readme
Axios intercept mock adapter
this is een extension off https://github.com/ctimmerm/axios-mock-adapter
It adds the possibility to intercept and modify the original response
you always need to add the folowing line after the intercepts
mock.onAny().passThrough()
#example
import client from 'src/domains/api/client'
import MockInterceptAdapter from '@laura-wert/axios-intercept-mock-adapter'
const mock = new MockInterceptAdapter(client)
mock.interceptGet('/me/orders')
.transformResponse((data: Order[]): void => {
data[0].id = 100
})
mock.interceptGet(/me\/order\/[0-9]*)
.transformResponse((data: ILevelSubject): void => {
console.log(data, process.env)
})
mock.onAny().passThrough()
s