Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[canvas] Run tests against @kbn/handlebars compileAST function #150439

Merged
merged 1 commit into from
Feb 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions x-pack/plugins/canvas/common/lib/handlebars.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { Handlebars } from './handlebars';

describe('handlebars', () => {
it('registers math function and returns argument error', () => {
const template = Handlebars.compile("test math: {{math rows 'mean(price * quantity)' 2}}");
const template = Handlebars.compileAST("test math: {{math rows 'mean(price * quantity)' 2}}");
expect(template()).toBe('test math: MATH ERROR: first argument must be an array');
});
it('evaluates math function successfully', () => {
const template = Handlebars.compile("test math: {{math rows 'mean(price * quantity)' 2}}");
const template = Handlebars.compileAST("test math: {{math rows 'mean(price * quantity)' 2}}");
expect(template(testTable)).toBe('test math: 82164.33');
});
});