Skip to content

Commit

Permalink
Fix linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
derekpierre committed Dec 18, 2024
1 parent c1a7617 commit 5477f6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/taco/src/conditions/context/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions packages/taco/test/taco.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ describe('taco', () => {
authorizationToken: ':authToken',
returnValueTest: {
comparator: '==',
value: true
}
value: true,
},
});

const messageKit = await taco.encrypt(
Expand All @@ -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']),
);
})}
);
});
});

0 comments on commit 5477f6f

Please sign in to comment.