@@ -75,6 +75,17 @@ setupContractTests({
7575 ) ,
7676 body : galaAppleBody
7777 } ,
78+ {
79+ endpoint : '/apples/add/gala' ,
80+ description : 'A request for adding a Gala apple with a different color' ,
81+ state : "I've added a Gala apple with a different color" ,
82+ method : 'post' ,
83+ handler : rest . post (
84+ 'http://localhost:8181/apples/add/:slug' ,
85+ ( req , res , ctx ) => res ( ctx . status ( 200 ) )
86+ ) ,
87+ body : { color : 'yellow' , type : 'Gala' }
88+ } ,
7889 {
7990 endpoint : '/apples/garden' ,
8091 description : 'A request for getting a garden' ,
@@ -167,6 +178,21 @@ describe('Contract files generated', () => {
167178 expect ( response . matchingRules ) . to . not . exist
168179 } )
169180
181+ it ( 'should generate the contract when doing a request for adding a Gala apple with a different color' , ( ) => {
182+ const data = getContractFileData ( {
183+ consumer,
184+ description : 'A request for adding a Gala apple with a different color'
185+ } )
186+ const { providerState, response, request} = data
187+
188+ expect ( providerState ) . to . eql (
189+ "I've added a Gala apple with a different color"
190+ )
191+ expect ( request . method ) . to . eql ( 'POST' )
192+ expect ( request . body ) . to . eql ( { color : 'yellow' , type : 'Gala' } )
193+ expect ( response . status ) . to . eql ( 200 )
194+ } )
195+
170196 it ( 'should generate the contract when doing a not found request' , ( ) => {
171197 const data = getContractFileData ( {
172198 consumer,
0 commit comments