mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-10 12:25:02 +00:00
Reformat all files with Prettier
This commit is contained in:
parent
0cde0d46d2
commit
ac79eb09f5
206 changed files with 727 additions and 888 deletions
|
@ -1,12 +1,12 @@
|
|||
import test from "ava";
|
||||
import { parseTemplate, renderParsedTemplate, renderTemplate, TemplateSafeValueContainer } from "./templateFormatter";
|
||||
|
||||
test("Parses plain string templates correctly", t => {
|
||||
test("Parses plain string templates correctly", (t) => {
|
||||
const result = parseTemplate("foo bar baz");
|
||||
t.deepEqual(result, ["foo bar baz"]);
|
||||
});
|
||||
|
||||
test("Parses templates with variables correctly", t => {
|
||||
test("Parses templates with variables correctly", (t) => {
|
||||
const result = parseTemplate("foo {bar} baz");
|
||||
t.deepEqual<any>(result, [
|
||||
"foo ",
|
||||
|
@ -18,7 +18,7 @@ test("Parses templates with variables correctly", t => {
|
|||
]);
|
||||
});
|
||||
|
||||
test("Parses templates with function variables correctly", t => {
|
||||
test("Parses templates with function variables correctly", (t) => {
|
||||
const result = parseTemplate('foo {bar("str", 5.07)} baz');
|
||||
t.deepEqual<any>(result, [
|
||||
"foo ",
|
||||
|
@ -30,7 +30,7 @@ test("Parses templates with function variables correctly", t => {
|
|||
]);
|
||||
});
|
||||
|
||||
test("Parses function variables with variable arguments correctly", t => {
|
||||
test("Parses function variables with variable arguments correctly", (t) => {
|
||||
const result = parseTemplate('foo {bar("str", 5.07, someVar)} baz');
|
||||
t.deepEqual<any>(result, [
|
||||
"foo ",
|
||||
|
@ -49,7 +49,7 @@ test("Parses function variables with variable arguments correctly", t => {
|
|||
]);
|
||||
});
|
||||
|
||||
test("Parses function variables with function variable arguments correctly", t => {
|
||||
test("Parses function variables with function variable arguments correctly", (t) => {
|
||||
const result = parseTemplate('foo {bar("str", 5.07, deeply(nested(8)))} baz');
|
||||
t.deepEqual<any>(result, [
|
||||
"foo ",
|
||||
|
@ -73,7 +73,7 @@ test("Parses function variables with function variable arguments correctly", t =
|
|||
]);
|
||||
});
|
||||
|
||||
test("Renders a parsed template correctly", async t => {
|
||||
test("Renders a parsed template correctly", async (t) => {
|
||||
const parseResult = parseTemplate('foo {bar("str", 5.07, deeply(nested(8)))} baz');
|
||||
const values = new TemplateSafeValueContainer({
|
||||
bar(strArg, numArg, varArg) {
|
||||
|
@ -91,18 +91,18 @@ test("Renders a parsed template correctly", async t => {
|
|||
t.is(renderResult, "foo str 5.07 !<?8?>! baz");
|
||||
});
|
||||
|
||||
test("Supports base values in renderTemplate", async t => {
|
||||
test("Supports base values in renderTemplate", async (t) => {
|
||||
const result = await renderTemplate('{if("", "+", "-")} {if(1, "+", "-")}');
|
||||
t.is(result, "- +");
|
||||
});
|
||||
|
||||
test("Edge case #1", async t => {
|
||||
test("Edge case #1", async (t) => {
|
||||
const result = await renderTemplate("{foo} {bar()}");
|
||||
// No "Unclosed function" exception = success
|
||||
t.pass();
|
||||
});
|
||||
|
||||
test("Parses empty string args as empty strings", async t => {
|
||||
test("Parses empty string args as empty strings", async (t) => {
|
||||
const result = parseTemplate('{foo("")}');
|
||||
t.deepEqual<any>(result, [
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue