Last active
September 22, 2021 09:48
-
-
Save sabesansathananthan/b898ab53afdfecd341cac27ccfaef675 to your computer and use it in GitHub Desktop.
mock network request in Jest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DataMapper } from "../../src"; | |
const data: DataMapper = { | |
"/api/setCounter": [ | |
{ | |
request: { | |
method: "POST", | |
data: '{"id":1,"operate":1}', | |
}, | |
response: { | |
status: 200, | |
json: { | |
result: 0, | |
}, | |
}, | |
}, | |
{ | |
request: { | |
method: "POST", | |
data: /"id":2,"operate":-1/, | |
}, | |
response: { | |
status: 200, | |
json: { | |
result: -100, | |
}, | |
}, | |
}, | |
], | |
}; | |
export default data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DataMapper } from "../../src"; | |
const data: DataMapper = { | |
"/api/setCounter": [ | |
{ | |
request: { | |
method: "POST", | |
data: /"id":3,"operate":-1/, | |
}, | |
response: { | |
status: 200, | |
json: { | |
result: -100, | |
}, | |
}, | |
}, | |
], | |
}; | |
export default data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment