Skip to content

Commit

Permalink
Fix escaping in query strings and update variable formatting in log r…
Browse files Browse the repository at this point in the history
…equests tests
  • Loading branch information
juan871003 committed Feb 8, 2025
1 parent 1ab9acb commit 97bdfeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/packages/server/src/apollo-plugins/log-requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ describe('getDidResolveOperationItemsToLog', () => {
expect(result).toEqual([
{
query:
'custom query called with "mutation test1($foo: String!) {\\n loginPassword(username: \\"testUser\\", password: $foo) {\\n authToken\\n }\\n}"',
variables: '{\"foo\":\"bar\"}',
'custom query called with "mutation test1($foo: String!) {\\n loginPassword(username: \\\"testUser\\\", password: $foo) {\\n authToken\\n }\\n}"',

Check failure on line 119 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"

Check failure on line 119 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"
variables: '{"foo":"bar"}',
},
]);
});
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('getDidResolveOperationItemsToLog', () => {
{
// TODO: $foo variable is not really needed here, we should remove it just like we did with the variable. However, we are not leaking sensitive data, just variable names.
query:
'custom query called with \"mutation test1($foo: String!) {\\n loginPassword(username: \\\"calledTwice\\\", password: \\\"asdf\\\") {\\n authToken\\n }\\n}\"',
'custom query called with "mutation test1($foo: String!) {\\n loginPassword(username: \\\"calledTwice\\\", password: \\\"asdf\\\") {\\n authToken\\n }\\n}"',

Check failure on line 160 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"

Check failure on line 160 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"

Check failure on line 160 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"

Check failure on line 160 in src/packages/server/src/apollo-plugins/log-requests.test.ts

View workflow job for this annotation

GitHub Actions / unit-tests

Unnecessary escape character: \"
// Notice that the variable stays with the query it belongs to (the first query).
variables: '{}',
},
Expand Down

0 comments on commit 97bdfeb

Please sign in to comment.