Fix sum
This commit is contained in:
parent
537eae7b98
commit
dc0bef20d8
|
@ -126,7 +126,7 @@
|
||||||
"array"
|
"array"
|
||||||
],
|
],
|
||||||
"numArgs": 1,
|
"numArgs": 1,
|
||||||
"example": "{{ sum 1 2 3 }} -> 6",
|
"example": "{{ sum '[1, 2, 3]' }} -> 6",
|
||||||
"description": "<p>Returns the sum of all numbers in the given array.</p>\n"
|
"description": "<p>Returns the sum of all numbers in the given array.</p>\n"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,9 +26,10 @@ describe("manifest", () => {
|
||||||
it.each(examples)("%s - %s", async (collection, func) => {
|
it.each(examples)("%s - %s", async (collection, func) => {
|
||||||
const example = manifest[collection][func].example
|
const example = manifest[collection][func].example
|
||||||
|
|
||||||
const [hbs, js] = example.split("->").map(x => x.trim())
|
let [hbs, js] = example.split("->").map(x => x.trim())
|
||||||
|
hbs = hbs.replace(/'\[1, 2, 3\]'/, "array")
|
||||||
|
|
||||||
expect(await processString(hbs)).toEqual(js)
|
expect(await processString(hbs, { array: [1, 2, 3] })).toEqual(js)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue