summaryrefslogtreecommitdiff
path: root/test/handlebars.test.js
diff options
context:
space:
mode:
authorJames Maa <jmaa@berkeley.edu>2024-05-09 15:42:35 +0800
committerGitHub <noreply@github.com>2024-05-09 07:42:35 +0000
commit13278a5cf67de69678d8c4c5fb97e6eb00c94c11 (patch)
tree1d77bcf97bb9c6f08c88c9f80ea0da735d5721c2 /test/handlebars.test.js
parent77fa1d0f64b66d6e4fe9c8795c7844206edbcaf2 (diff)
Update eslint unsafe rule (#887)
* Enable @typescript-eslint/no-unsafe-assignment * Updates * Add missing import * Updates * Fix types? * Fix tests * Address comments * Move TextProcessorVariant to types * Update types/ext/translation-internal.d.ts Co-authored-by: StefanVukovic99 <stefanvukovic44@gmail.com> Signed-off-by: James Maa <jmaa@berkeley.edu> --------- Signed-off-by: James Maa <jmaa@berkeley.edu> Co-authored-by: toasted-nutbread <toasted-nutbread@users.noreply.github.com> Co-authored-by: StefanVukovic99 <stefanvukovic44@gmail.com>
Diffstat (limited to 'test/handlebars.test.js')
-rw-r--r--test/handlebars.test.js24
1 files changed, 20 insertions, 4 deletions
diff --git a/test/handlebars.test.js b/test/handlebars.test.js
index d65e8c42..8a566f4c 100644
--- a/test/handlebars.test.js
+++ b/test/handlebars.test.js
@@ -18,6 +18,22 @@
import {describe, test} from 'vitest';
import {Handlebars} from '../ext/lib/handlebars.js';
+/**
+ * @param {string} template
+ * @returns {import('handlebars').TemplateDelegate<unknown>}
+ */
+function compile(template) {
+ return Handlebars.compile(template);
+}
+
+/**
+ * @param {string} template
+ * @returns {import('handlebars').TemplateDelegate<unknown>}
+ */
+function compileAST(template) {
+ return Handlebars.compileAST(template);
+}
+
describe('Handlebars', () => {
test('compile vs compileAST 1', ({expect}) => {
const template = '{{~test1~}}';
@@ -26,8 +42,8 @@ describe('Handlebars', () => {
test1: '<div style="font-size: 4em;">Test</div>'
};
- const instance1 = Handlebars.compile(template);
- const instance2 = Handlebars.compileAST(template);
+ const instance1 = compile(template);
+ const instance2 = compileAST(template);
const result1 = instance1(data);
const result2 = instance2(data);
@@ -44,8 +60,8 @@ describe('Handlebars', () => {
}
};
- const instance1 = Handlebars.compile(template);
- const instance2 = Handlebars.compileAST(template);
+ const instance1 = compile(template);
+ const instance2 = compileAST(template);
const result1 = instance1(data);
const result2 = instance2(data);