1
0
Fork 0
mirror of synced 2024-07-01 20:41:03 +12:00

Fixing issue with regex helper - escape test used the word 'test' a lot which breaks the helper.

This commit is contained in:
mike12345567 2021-02-02 18:01:41 +00:00
parent 711ab8a070
commit 08cf4bf292

View file

@ -4,15 +4,15 @@ const {
describe("Handling context properties with spaces in their name", () => {
it("should allow through literal specifiers", async () => {
const output = await processString("test {{ [test thing] }}", {
"test thing": 1
const output = await processString("test {{ [one thing] }}", {
"one thing": 1
})
expect(output).toBe("test 1")
})
it("should convert to dot notation where required", async () => {
const output = await processString("test {{ test[0] }}", {
test: [2]
const output = await processString("test {{ one[0] }}", {
one: [2]
})
expect(output).toBe("test 2")
})
@ -25,9 +25,9 @@ describe("Handling context properties with spaces in their name", () => {
})
it("should be able to handle an object with layers that requires escaping", async () => {
const output = await processString("testcase {{ testing.[test case] }}", {
testing: {
"test case": 1
const output = await processString("testcase {{ thing.[one case] }}", {
thing: {
"one case": 1
}
})
expect(output).toBe("testcase 1")
@ -52,10 +52,10 @@ describe("attempt some complex problems", () => {
it("should be able to process an odd string produced by builder", async () => {
const context = {
"c306d140d7e854f388bae056db380a0eb": {
"test prop": "test",
"one prop": "test",
}
}
const hbs = "null{{ [c306d140d7e854f388bae056db380a0eb].[test prop] }}"
const hbs = "null{{ [c306d140d7e854f388bae056db380a0eb].[one prop] }}"
const output = await processString(hbs, context)
expect(output).toBe("nulltest")
})