Skip to content

Commit

Permalink
test: quotes are escaped
Browse files Browse the repository at this point in the history
  • Loading branch information
sezanzeb committed Apr 8, 2022
1 parent 4b7126a commit 56c8c82
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/core/test/unit/query/flux.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ describe('Flux Tagged Template', () => {
'from(bucket:"my-bucket") |> range(start: 0) |> filter(fn: (r) => r._measurement == "temperature")'
)
})
it('escapes double-quotes', () => {
const injection = 'temperature") |> foo'
expect(
flux`from(bucket:${'my-bucket'}) |> filter(fn: (r) => r._measurement == "${injection}")`.toString()
).equals(
'from(bucket:"my-bucket") |> filter(fn: (r) => r._measurement == "temperature\\") |> foo")'
)
})
it('interpolates a wrapped string', () => {
expect(flux`from(bucket:"${'my-bucket'}")`.toString()).equals(
'from(bucket:"my-bucket")'
Expand Down

0 comments on commit 56c8c82

Please sign in to comment.