Escape quotes in identifiers in CQL queries

This commit is contained in:
Armando Trejo Oliver
2020-10-12 11:00:11 -07:00
committed by GitHub
parent a9a57f4ba9
commit 5ffa746adb
5 changed files with 40 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
import { getQuotedCqlIdentifier } from "./CqlUtilities";
describe("getQuotedCqlIdentifier", () => {
it("undefined id", () => {
const result = getQuotedCqlIdentifier(undefined);
expect(result).toBe(undefined);
});
it("id with no quotes", () => {
const result = getQuotedCqlIdentifier("foo");
expect(result).toBe('"foo"');
});
it("id with quotes", () => {
const result = getQuotedCqlIdentifier('"foo"');
expect(result).toBe('"""foo"""');
});
});