Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeAll((done) => {
provider.addInteraction({
state: `person 42 exists`,
uponReceiving: 'a request to PUT a person',
withRequest: {
method: 'PUT',
path: '/user-service/users/42',
body: Matchers.somethingLike(expectedUser),
headers: {
'Content-Type': 'application/json'
}
},
willRespondWith: {
status: 200,
body: Matchers.somethingLike(expectedUser)
}
}).then(done, error => done.fail(error));
});
beforeAll((done) => {
provider.addInteraction({
state: `provider accepts a new person`,
uponReceiving: 'a request to POST a person',
withRequest: {
method: 'POST',
path: '/user-service/users',
body: expectedUser,
headers: {
'Content-Type': 'application/json'
}
},
willRespondWith: {
status: 201,
body: Matchers.somethingLike({
id: createdUserId
}),
headers: {
'Content-Type': 'application/json'
}
}
}).then(done, error => done.fail(error));
});