2021-04-07 11:56:06 +02:00
|
|
|
const { processString } = require("../src/index.cjs")
|
2021-01-21 13:08:57 +01:00
|
|
|
|
|
|
|
describe("specific test case for whether or not full app template can still be rendered", () => {
|
|
|
|
it("should be able to render the app template", async () => {
|
2021-04-07 11:56:06 +02:00
|
|
|
const template = `<!doctype html>
|
2021-01-21 13:08:57 +01:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
{{{head}}}
|
|
|
|
</head>
|
|
|
|
<script>
|
|
|
|
window["##BUDIBASE_APP_ID##"] = "{{appId}}"
|
|
|
|
</script>
|
|
|
|
{{{body}}}
|
|
|
|
</html>`
|
|
|
|
const context = {
|
|
|
|
appId: "App1",
|
|
|
|
head: "<title>App</title>",
|
2021-04-07 11:56:06 +02:00
|
|
|
body: "<body><p>App things</p></body>",
|
2021-01-21 13:08:57 +01:00
|
|
|
}
|
|
|
|
const output = await processString(template, context)
|
|
|
|
expect(output).toBe(`<!doctype html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>App</title>
|
|
|
|
</head>
|
|
|
|
<script>
|
|
|
|
window["##BUDIBASE_APP_ID##"] = "App1"
|
|
|
|
</script>
|
|
|
|
<body><p>App things</p></body>
|
|
|
|
</html>`)
|
|
|
|
})
|
2021-04-07 11:56:06 +02:00
|
|
|
})
|