Fix tests
This commit is contained in:
parent
acbb06edf7
commit
bd4b14e995
|
@ -51,11 +51,11 @@ const HELPERS = [
|
||||||
if (value && (value as any).string) {
|
if (value && (value as any).string) {
|
||||||
value = (value as any).string
|
value = (value as any).string
|
||||||
}
|
}
|
||||||
let text = value
|
let text: any = value
|
||||||
if (__opts && __opts.escapeNewlines) {
|
if (__opts && __opts.escapeNewlines) {
|
||||||
text = value.replace(/\n/g, "\\n")
|
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") {
|
if (text == null || typeof text !== "string") {
|
||||||
return text
|
return text
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,14 +342,14 @@ describe("Test the literal helper", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should allow use of the literal specifier for an object", async () => {
|
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 },
|
a: { b: 1 },
|
||||||
})
|
})
|
||||||
expect(output.b).toBe(1)
|
expect(output.b).toBe(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should allow use of the literal specifier for an object with dashes", async () => {
|
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" },
|
a: { b: "i-have-dashes" },
|
||||||
})
|
})
|
||||||
expect(output.b).toBe("i-have-dashes")
|
expect(output.b).toBe("i-have-dashes")
|
||||||
|
|
Loading…
Reference in New Issue