diff --git a/packages/string-templates/test/basic.spec.js b/packages/string-templates/test/basic.spec.js
index 7edf89c6c3..5732181b13 100644
--- a/packages/string-templates/test/basic.spec.js
+++ b/packages/string-templates/test/basic.spec.js
@@ -4,19 +4,19 @@ const {
isValid,
makePropSafe,
getManifest,
-} = require("../src/index")
+} = require("../src/index.cjs")
describe("Test that the string processing works correctly", () => {
it("should process a basic template string", async () => {
const output = await processString("templating is {{ adjective }}", {
- adjective: "easy"
+ adjective: "easy",
})
expect(output).toBe("templating is easy")
})
it("should process a literal template", async () => {
const output = await processString("derp is {{{ adjective }}}", {
- adjective: "derp"
+ adjective: "derp",
})
expect(output).toBe("derp is derp")
})
@@ -42,23 +42,29 @@ describe("Test that the string processing works correctly", () => {
describe("Test that the object processing works correctly", () => {
it("should be able to process an object with some template strings", async () => {
- const output = await processObject({
- first: "thing is {{ adjective }}",
- second: "thing is bad",
- third: "we are {{ adjective }} {{ noun }}",
- }, {
- adjective: "easy",
- noun: "people",
- })
+ const output = await processObject(
+ {
+ first: "thing is {{ adjective }}",
+ second: "thing is bad",
+ third: "we are {{ adjective }} {{ noun }}",
+ },
+ {
+ adjective: "easy",
+ noun: "people",
+ }
+ )
expect(output.first).toBe("thing is easy")
expect(output.second).toBe("thing is bad")
expect(output.third).toBe("we are easy people")
})
it("should be able to handle arrays of string templates", async () => {
- const output = await processObject(["first {{ noun }}", "second {{ noun }}"], {
- noun: "person"
- })
+ const output = await processObject(
+ ["first {{ noun }}", "second {{ noun }}"],
+ {
+ noun: "person",
+ }
+ )
expect(output[0]).toBe("first person")
expect(output[1]).toBe("second person")
})
@@ -107,6 +113,8 @@ describe("check manifest", () => {
it("should be able to retrieve the manifest", () => {
const manifest = getManifest()
expect(manifest.math).not.toBeNull()
- expect(manifest.math.abs.description).toBe("
Return the magnitude of a
.
\n")
+ expect(manifest.math.abs.description).toBe(
+ "Return the magnitude of a
.
\n"
+ )
})
-})
\ No newline at end of file
+})
diff --git a/packages/string-templates/test/escapes.spec.js b/packages/string-templates/test/escapes.spec.js
index 21b1c4bcb0..7e55b66b88 100644
--- a/packages/string-templates/test/escapes.spec.js
+++ b/packages/string-templates/test/escapes.spec.js
@@ -1,18 +1,16 @@
-const {
- processString,
-} = require("../src/index")
+const { processString } = require("../src/index.cjs")
describe("Handling context properties with spaces in their name", () => {
it("should allow through literal specifiers", async () => {
const output = await processString("test {{ [one thing] }}", {
- "one thing": 1
+ "one thing": 1,
})
expect(output).toBe("test 1")
})
it("should convert to dot notation where required", async () => {
const output = await processString("test {{ one[0] }}", {
- one: [2]
+ one: [2],
})
expect(output).toBe("test 2")
})
@@ -27,8 +25,8 @@ describe("Handling context properties with spaces in their name", () => {
it("should be able to handle an object with layers that requires escaping", async () => {
const output = await processString("testcase {{ thing.[one case] }}", {
thing: {
- "one case": 1
- }
+ "one case": 1,
+ },
})
expect(output).toBe("testcase 1")
})
@@ -39,24 +37,25 @@ describe("attempt some complex problems", () => {
const context = {
"New Repeater": {
"Get Actors": {
- "first_name": "Bob",
- "last_name": "Bobert"
+ first_name: "Bob",
+ last_name: "Bobert",
},
},
}
- const hbs = "{{ [New Repeater].[Get Actors].[first_name] }} {{ [New Repeater].[Get Actors].[last_name] }}"
+ const hbs =
+ "{{ [New Repeater].[Get Actors].[first_name] }} {{ [New Repeater].[Get Actors].[last_name] }}"
const output = await processString(hbs, context)
expect(output).toBe("Bob Bobert")
})
it("should be able to process an odd string produced by builder", async () => {
const context = {
- "c306d140d7e854f388bae056db380a0eb": {
+ c306d140d7e854f388bae056db380a0eb: {
"one prop": "test",
- }
+ },
}
const hbs = "null{{ [c306d140d7e854f388bae056db380a0eb].[one prop] }}"
const output = await processString(hbs, context)
expect(output).toBe("nulltest")
})
-})
\ No newline at end of file
+})
diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js
index 08366a8296..10ca0a564c 100644
--- a/packages/string-templates/test/helpers.spec.js
+++ b/packages/string-templates/test/helpers.spec.js
@@ -1,4 +1,4 @@
-const { processString, processObject, isValid } = require("../src/index")
+const { processString, processObject, isValid } = require("../src/index.cjs")
describe("test the custom helpers we have applied", () => {
it("should be able to use the object helper", async () => {
diff --git a/packages/string-templates/test/renderApp.spec.js b/packages/string-templates/test/renderApp.spec.js
index 1ae08ee113..13d478980d 100644
--- a/packages/string-templates/test/renderApp.spec.js
+++ b/packages/string-templates/test/renderApp.spec.js
@@ -1,9 +1,8 @@
-const { processString } = require("../src/index")
+const { processString } = require("../src/index.cjs")
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 () => {
- const template =
- `
+ const template = `
{{{head}}}
@@ -16,7 +15,7 @@ describe("specific test case for whether or not full app template can still be r
const context = {
appId: "App1",
head: "App",
- body: "App things
"
+ body: "App things
",
}
const output = await processString(template, context)
expect(output).toBe(`
@@ -30,4 +29,4 @@ describe("specific test case for whether or not full app template can still be r
App things
`)
})
-})
\ No newline at end of file
+})