Add basic test

This commit is contained in:
Adria Navarro 2024-01-31 13:59:16 +01:00
parent ed7b89f2f9
commit 786acaa121
1 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { processStringSync, encodeJSBinding } from "@budibase/string-templates"
import TestConfiguration from "../../tests/utilities/TestConfiguration"
describe("jsRunner", () => {
const config = new TestConfiguration()
beforeAll(async () => {
await config.init()
})
const processJS = (js: string, context?: object) => {
return config.doInContext(config.getAppId(), async () =>
processStringSync(encodeJSBinding(js), context || {})
)
}
it("it can run a basic javascript", async () => {
const output = await processJS(`return 1 + 2`)
expect(output).toBe(3)
})
})