forked from tsai/budibase
13 changed files with 70 additions and 43 deletions
@ -0,0 +1,21 @@ |
|||
const { |
|||
processString, |
|||
} = require("../src/index") |
|||
|
|||
describe("Handling context properties with spaces in their name", () => { |
|||
it("should be able to handle a property with a space in its name", () => { |
|||
const output = processString("hello my name is {{ person name }}", { |
|||
"person name": "Mike", |
|||
}) |
|||
expect(output).toBe("hello my name is Mike") |
|||
}) |
|||
|
|||
it("should be able to handle an object with layers that requires escaping", () => { |
|||
const output = processString("testcase {{ testing.test case }}", { |
|||
testing: { |
|||
"test case": 1 |
|||
} |
|||
}) |
|||
expect(output).toBe("testcase 1") |
|||
}) |
|||
}) |
|||
@ -0,0 +1,12 @@ |
|||
const { |
|||
processString, |
|||
} = require("../src/index") |
|||
|
|||
describe("test the custom helpers we have applied", () => { |
|||
it("should be able to use the object helper", () => { |
|||
const output = processString("object is {{ object obj }}", { |
|||
obj: { a: 1 }, |
|||
}) |
|||
expect(output).toBe("object is {\"a\":1}") |
|||
}) |
|||
}) |
|||
Loading…
Reference in new issue