diff --git a/packages/taco/src/conditions/context/context.ts b/packages/taco/src/conditions/context/context.ts index 3f9cf1f6..dd4a2815 100644 --- a/packages/taco/src/conditions/context/context.ts +++ b/packages/taco/src/conditions/context/context.ts @@ -181,14 +181,16 @@ export class ConditionContext { } // If it's a JSON API condition, check url and query if (condition.conditionType === JsonApiConditionType) { - const urlComponents = condition.endpoint.replace("https://", "").split("/"); + const urlComponents = condition.endpoint + .replace('https://', '') + .split('/'); for (const param of urlComponents ?? []) { if (this.isContextParameter(param)) { requestedParameters.add(param); } } if (condition.query) { - const queryParams = condition.query.match(":[a-zA-Z_]+"); + const queryParams = condition.query.match(':[a-zA-Z_]+'); if (queryParams) { for (const param of queryParams) { requestedParameters.add(param); diff --git a/packages/taco/test/taco.test.ts b/packages/taco/test/taco.test.ts index 539294bd..1906c34a 100644 --- a/packages/taco/test/taco.test.ts +++ b/packages/taco/test/taco.test.ts @@ -150,8 +150,8 @@ describe('taco', () => { authorizationToken: ':authToken', returnValueTest: { comparator: '==', - value: true - } + value: true, + }, }); const messageKit = await taco.encrypt( @@ -166,10 +166,10 @@ describe('taco', () => { const conditionContext = ConditionContext.fromMessageKit(messageKit); const requestedParameters = conditionContext.requestedContextParameters; - + // Verify all context parameters from endpoint, query and authToken are detected expect(requestedParameters).toEqual( - new Set([':userId', ':userAddress', ':authToken']) + new Set([':userId', ':userAddress', ':authToken']), ); - })} -); + }); +});