Add basic test
This commit is contained in:
parent
ed7b89f2f9
commit
786acaa121
|
@ -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)
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue