@@ -29,12 +29,14 @@ export const steps = ({
2929 requestsTableName,
3030 ssm,
3131 stackName,
32+ prefix,
3233} : {
3334 db : DynamoDBClient
3435 responsesTableName : string
3536 requestsTableName : string
3637 ssm : SSMClient
3738 stackName : string
39+ prefix : string
3840} ) : StepRunner < Record < string , any > > [ ] => {
3941 const mockShadowData = regExpMatchedStep (
4042 {
@@ -54,7 +56,7 @@ export const steps = ({
5456 deviceIds : deviceId ,
5557 } )
5658
57- const methodPathQuery = `GET v1/devices?${ sortQuery ( query ) } `
59+ const methodPathQuery = `GET ${ prefix } / v1/devices?${ sortQuery ( query ) } `
5860 progress ( `Mock http url: ${ methodPathQuery } ` )
5961 await db . send (
6062 new PutItemCommand ( {
@@ -87,7 +89,7 @@ export const steps = ({
8789 async ( { match : { methodPathQuery } , log : { progress } , step } ) => {
8890 const expectedResponse = codeBlockOrThrow ( step ) . code
8991 const response = parseMockResponse ( expectedResponse )
90- progress ( `expected query: ${ methodPathQuery } ` )
92+ progress ( `expected query: ${ prefix } / ${ methodPathQuery } ` )
9193 const [ method , resourceWithQuery ] = methodPathQuery . split ( ' ' ) as [
9294 string ,
9395 string ,
@@ -105,7 +107,7 @@ export const steps = ({
105107
106108 await registerResponse ( db , responsesTableName , {
107109 method,
108- path : resource . slice ( 1 ) ,
110+ path : ` ${ prefix } / ${ resource . slice ( 1 ) } ` ,
109111 body : body . length > 0 ? body . join ( '\n' ) : undefined ,
110112 queryParams : queryParams ? new URLSearchParams ( queryParams ) : undefined ,
111113 statusCode : response . statusCode ,
@@ -132,7 +134,7 @@ export const steps = ({
132134 }
133135
134136 const methodPathQuery = `${ request . method } ${ sortQueryString ( request . resource . slice ( 1 ) ) } `
135- progress ( `expected query: ${ methodPathQuery } ` )
137+ progress ( `expected query: ${ prefix } / ${ methodPathQuery } ` )
136138
137139 const scanRequests = async ( ) => {
138140 const result = await db . send (
@@ -145,7 +147,7 @@ export const steps = ({
145147 '#headers' : 'headers' ,
146148 } ,
147149 ExpressionAttributeValues : {
148- ':methodPathQuery' : { S : methodPathQuery } ,
150+ ':methodPathQuery' : { S : ` ${ prefix } / ${ methodPathQuery } ` } ,
149151 } ,
150152 ProjectionExpression : '#body, #headers' ,
151153 ScanIndexForward : false ,
@@ -229,7 +231,7 @@ export const steps = ({
229231 } ,
230232 ExpressionAttributeValues : {
231233 ':method' : { S : 'GET' } ,
232- ':path' : { S : ' v1/devices' } ,
234+ ':path' : { S : ` ${ prefix } / v1/devices` } ,
233235 ':timestamp' : { S : fiveMinutesAgo . toISOString ( ) } ,
234236 } ,
235237 ProjectionExpression : '#timestamp, #query, #headers' ,
0 commit comments