Test only js helpers
This commit is contained in:
parent
f5157c4184
commit
43e536e7a6
|
@ -3,6 +3,8 @@ const helperList = require("@budibase/handlebars-helpers")
|
|||
|
||||
let helpers = undefined
|
||||
|
||||
const helpersToRemove = ["sortBy"]
|
||||
|
||||
module.exports.getHelperList = () => {
|
||||
if (helpers) {
|
||||
return helpers
|
||||
|
@ -23,6 +25,9 @@ module.exports.getHelperList = () => {
|
|||
helpers[key] = externalHandlebars.addedHelpers[key]
|
||||
}
|
||||
|
||||
for (const toRemove of helpersToRemove) {
|
||||
delete helpers[toRemove]
|
||||
}
|
||||
Object.freeze(helpers)
|
||||
return helpers
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ const {
|
|||
} = require("../src/index.cjs")
|
||||
|
||||
const tk = require("timekeeper")
|
||||
const { getHelperList } = require("../src/helpers")
|
||||
|
||||
tk.freeze("2021-01-21T12:00:00")
|
||||
|
||||
|
@ -108,9 +109,15 @@ describe("manifest", () => {
|
|||
})
|
||||
|
||||
describe("can be parsed and run as js", () => {
|
||||
describe.each(Object.keys(examples))("%s", collection => {
|
||||
const jsHelpers = getHelperList()
|
||||
const jsExamples = Object.keys(examples).reduce((acc, v) => {
|
||||
acc[v] = examples[v].filter(([key]) => jsHelpers[key])
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
describe.each(Object.keys(jsExamples))("%s", collection => {
|
||||
it.each(
|
||||
examples[collection].filter(
|
||||
jsExamples[collection].filter(
|
||||
([_, { requiresHbsBody }]) => !requiresHbsBody
|
||||
)
|
||||
)("%s", async (_, { hbs, js }) => {
|
||||
|
|
Loading…
Reference in New Issue