Fix tests

This commit is contained in:
Adria Navarro 2024-03-14 23:51:24 +01:00
parent acbb06edf7
commit bd4b14e995
2 changed files with 4 additions and 4 deletions

View File

@ -51,11 +51,11 @@ const HELPERS = [
if (value && (value as any).string) {
value = (value as any).string
}
let text = value
let text: any = value
if (__opts && __opts.escapeNewlines) {
text = value.replace(/\n/g, "\\n")
}
text = new SafeString(text.replace(/&/g, "&")).toString()
text = new SafeString(text.replace(/&/g, "&"))
if (text == null || typeof text !== "string") {
return text
}

View File

@ -342,14 +342,14 @@ describe("Test the literal helper", () => {
})
it("should allow use of the literal specifier for an object", async () => {
const output = await processString(`{{literal a}}`, {
const output: any = await processString(`{{literal a}}`, {
a: { b: 1 },
})
expect(output.b).toBe(1)
})
it("should allow use of the literal specifier for an object with dashes", async () => {
const output = await processString(`{{literal a}}`, {
const output: any = await processString(`{{literal a}}`, {
a: { b: "i-have-dashes" },
})
expect(output.b).toBe("i-have-dashes")