Update JS HBS helper tests
This commit is contained in:
parent
0dfa108ef5
commit
9ec1992522
|
@ -4,7 +4,21 @@ const processJS = (js, context) => {
|
||||||
return processStringSync(encodeJSBinding(js), context)
|
return processStringSync(encodeJSBinding(js), context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe("Test the JavaScript helper in Node", () => {
|
||||||
|
it("should not execute JS in Node", () => {
|
||||||
|
const output = processJS(`return 1`)
|
||||||
|
expect(output).toBe("JS bindings are not executed in a Node environment")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("Test the JavaScript helper", () => {
|
describe("Test the JavaScript helper", () => {
|
||||||
|
// JS bindings do not get evaluated on the server for safety.
|
||||||
|
// Since we want to run SJ for tests, we fake a window object to make
|
||||||
|
// it think that we're in the browser
|
||||||
|
beforeEach(() => {
|
||||||
|
window = {}
|
||||||
|
})
|
||||||
|
|
||||||
it("should execute a simple expression", () => {
|
it("should execute a simple expression", () => {
|
||||||
const output = processJS(`return 1 + 2`)
|
const output = processJS(`return 1 + 2`)
|
||||||
expect(output).toBe("3")
|
expect(output).toBe("3")
|
||||||
|
|
Loading…
Reference in New Issue