From dc0bef20d86d92018cebb5e549571fc17e87d24a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 22 Jan 2024 12:16:52 +0100 Subject: [PATCH] Fix sum --- packages/string-templates/manifest.json | 2 +- packages/string-templates/test/manifest.spec.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/string-templates/manifest.json b/packages/string-templates/manifest.json index 951f5fecdc..008c537abc 100644 --- a/packages/string-templates/manifest.json +++ b/packages/string-templates/manifest.json @@ -126,7 +126,7 @@ "array" ], "numArgs": 1, - "example": "{{ sum 1 2 3 }} -> 6", + "example": "{{ sum '[1, 2, 3]' }} -> 6", "description": "

Returns the sum of all numbers in the given array.

\n" } }, diff --git a/packages/string-templates/test/manifest.spec.js b/packages/string-templates/test/manifest.spec.js index 62fd5acf99..2457467de3 100644 --- a/packages/string-templates/test/manifest.spec.js +++ b/packages/string-templates/test/manifest.spec.js @@ -26,9 +26,10 @@ describe("manifest", () => { it.each(examples)("%s - %s", async (collection, func) => { 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) }) }) })