Skip to content

Commit

Permalink
Add test for boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasmattheussen committed Aug 2, 2023
1 parent 96a66a9 commit 72d6d73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/checkAndEvaluateMath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ function parseAndReduce(expr: string): string {
}`;
}

export function checkAndEvaluateMath(expr: string | number | undefined): string | undefined {
export function checkAndEvaluateMath(
expr: string | number | boolean | undefined,
): string | undefined {
if (expr === undefined) {
return expr;
}
Expand Down
5 changes: 5 additions & 0 deletions test/spec/checkAndEvaluateMath.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,9 @@ describe('check and evaluate math', () => {
it('supports values that contain spaces and strings, e.g. a date format', () => {
expect(checkAndEvaluateMath(`dd/MM/yyyy 'om' HH:mm`)).to.equal(`dd/MM/yyyy om HH:mm`);
});

it('supports boolean values', () => {
expect(checkAndEvaluateMath(false)).to.equal(false);
expect(checkAndEvaluateMath(true)).to.equal(false);
});
});

0 comments on commit 72d6d73

Please sign in to comment.