This commit is contained in:
Adria Navarro 2024-02-01 12:30:59 +01:00
parent 1439eb9b27
commit 843d95c3bb
2 changed files with 5 additions and 3 deletions

View File

@ -18,11 +18,13 @@ jest.mock("@budibase/handlebars-helpers/lib/uuid", () => {
})
import { processStringSync, encodeJSBinding } from "@budibase/string-templates"
const { runJsHelpersTests } = require("@budibase/string-templates/test/utils")
import tk from "timekeeper"
import { init } from ".."
import TestConfiguration from "../../tests/utilities/TestConfiguration"
tk.freeze("2021-01-21T12:00:00")
describe("jsRunner", () => {

View File

@ -13,7 +13,7 @@ function tryParseJson(str) {
}
try {
return JSON.parse(str.replace(/\'/g, '"'))
return JSON.parse(str.replace(/'/g, '"'))
} catch (e) {
return
}
@ -34,7 +34,7 @@ const getParsedManifest = () => {
}
// Trim 's
js = js.replace(/^\'|\'$/g, "")
js = js.replace(/^'|'$/g, "")
let parsedExpected
if ((parsedExpected = tryParseJson(js))) {
if (Array.isArray(parsedExpected)) {
@ -97,7 +97,7 @@ module.exports.runJsHelpersTests = ({ funcWrap, testsToSkip } = {}) => {
new RegExp(escapeRegExp(arrayString)),
`array${i}`
)
context[`array${i}`] = JSON.parse(arrayString.replace(/\'/g, '"'))
context[`array${i}`] = JSON.parse(arrayString.replace(/'/g, '"'))
})
let convertedJs = convertToJS(hbs)