Slide 76
Slide 76 text
JavaScript Testing
© 2017 - 2024 Siam Chamnankit Company Limited. All rights reserved.
76
Create Contract with PACT
describe('when a request to login is made', () => {
before(() => {
return provider.addInteraction({
uponReceiving: 'a request to login',
withRequest: {
method: 'POST',
path: '/login',
body: {
user: 'somkiat',
pass: '1234',
},
},
willRespondWith: {
status: 200,
body: {
message: like('success'),
token: like('jwt token'),
},
},
Define contract by case (success)