@@ -12,8 +12,8 @@ describe("Mockttp rule building", function () {
1212
1313 it ( "should allow manually adding a single rule" , async ( ) => {
1414 await server . addRequestRules ( {
15- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
16- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'mock response' ) ]
15+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
16+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'mock response' ) ]
1717 } ) ;
1818
1919 let response = await fetch ( server . urlFor ( '/endpoint' ) ) ;
@@ -27,21 +27,21 @@ describe("Mockttp rule building", function () {
2727
2828 const rule = await server . addRequestRules ( {
2929 id : manualId ,
30- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
31- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'mock response' ) ]
30+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
31+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'mock response' ) ]
3232 } ) ;
3333
3434 expect ( rule [ 0 ] . id ) . to . equal ( manualId ) ;
3535 } ) ;
3636
3737 it ( "should allow repeatedly adding rules" , async ( ) => {
3838 await server . addRequestRules ( {
39- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
40- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'first mock response' ) ]
39+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
40+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'first mock response' ) ]
4141 } ) ;
4242 await server . addRequestRules ( {
43- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
44- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'second mock response' ) ]
43+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
44+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'second mock response' ) ]
4545 } ) ;
4646
4747 let firstResponse = await fetch ( server . urlFor ( '/endpoint' ) ) ;
@@ -55,12 +55,12 @@ describe("Mockttp rule building", function () {
5555
5656 it ( "should allow completely replacing rules" , async ( ) => {
5757 await server . addRequestRules ( {
58- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
59- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'original mock response' ) ]
58+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
59+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'original mock response' ) ]
6060 } ) ;
6161 await server . setRequestRules ( {
62- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
63- steps : [ new requestSteps . SimpleStepDefinition ( 200 , '' , 'replacement mock response' ) ]
62+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
63+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'replacement mock response' ) ]
6464 } ) ;
6565
6666 let firstResponse = await fetch ( server . urlFor ( '/endpoint' ) ) ;
@@ -95,10 +95,10 @@ describe("Mockttp rule building", function () {
9595
9696 it ( "should allow manually adding a multi-step rule" , async ( ) => {
9797 await server . addRequestRules ( {
98- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
98+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
9999 steps : [
100100 new requestSteps . DelayStepDefinition ( 10 ) ,
101- new requestSteps . SimpleStepDefinition ( 200 , '' , 'mock response' )
101+ new requestSteps . FixedResponseStepDefinition ( 200 , '' , 'mock response' )
102102 ]
103103 } ) ;
104104
@@ -112,15 +112,15 @@ describe("Mockttp rule building", function () {
112112 return expect ( ( async ( ) => { // Funky setup to handle sync & async failure for node & browser
113113 await server . addRequestRules ( {
114114 matchers : [ ] ,
115- steps : [ new requestSteps . SimpleStepDefinition ( 200 , 'mock response' ) ]
115+ steps : [ new requestSteps . FixedResponseStepDefinition ( 200 , 'mock response' ) ]
116116 } )
117117 } ) ( ) ) . to . be . rejectedWith ( 'Cannot create a rule without at least one matcher' ) ;
118118 } ) ;
119119
120120 it ( "should reject rules with no steps value" , async ( ) => {
121121 return expect ( ( async ( ) => { // Funky setup to handle sync & async failure for node & browser
122122 await server . addRequestRules ( {
123- matchers : [ new matchers . SimplePathMatcher ( '/' ) ] ,
123+ matchers : [ new matchers . FlexiblePathMatcher ( '/' ) ] ,
124124 steps : null as any
125125 } )
126126 } ) ( ) ) . to . be . rejectedWith ( 'Cannot create a rule with no steps' ) ;
@@ -129,7 +129,7 @@ describe("Mockttp rule building", function () {
129129 it ( "should reject rules with an empty steps list" , async ( ) => {
130130 return expect ( ( async ( ) => { // Funky setup to handle sync & async failure for node & browser
131131 await server . addRequestRules ( {
132- matchers : [ new matchers . SimplePathMatcher ( '/' ) ] ,
132+ matchers : [ new matchers . FlexiblePathMatcher ( '/' ) ] ,
133133 steps : [ ]
134134 } )
135135 } ) ( ) ) . to . be . rejectedWith ( 'Cannot create a rule with no steps' ) ;
@@ -138,9 +138,9 @@ describe("Mockttp rule building", function () {
138138 it ( "should reject rules with non-final final-only steps" , async ( ) => {
139139 return expect ( ( async ( ) => { // Funky setup to handle sync & async failure for node & browser
140140 await server . addRequestRules ( {
141- matchers : [ new matchers . SimplePathMatcher ( '/endpoint' ) ] ,
141+ matchers : [ new matchers . FlexiblePathMatcher ( '/endpoint' ) ] ,
142142 steps : [
143- new requestSteps . SimpleStepDefinition ( 200 ) ,
143+ new requestSteps . FixedResponseStepDefinition ( 200 ) ,
144144 new requestSteps . DelayStepDefinition ( 100 )
145145 ]
146146 } ) ;
0 commit comments