chore: 补充几个 formula 现有实现的用例避免后续改错 (#5218)

This commit is contained in:
吴多益 2022-08-24 10:31:24 +08:00 committed by GitHub
parent 363f389ee6
commit 9cf6a41a62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,12 @@ test('formula:expression2', () => {
expect(evalFormual('a[c ? 1 : 2]', {a: [1, 2, 3], b: 1})).toBe(3);
});
test('formula:expression3', () => {
expect(evalFormual('${a} === "b"', {a: 'b'})).toBe(true);
expect(evalFormual('b === "b"')).toBe(false);
expect(evalFormual('${a}', {a: 'b'})).toBe('b');
});
test('formula:if', () => {
expect(evalFormual('IF(true, 2, 3)')).toBe(2);
expect(evalFormual('IF(false, 2, 3)')).toBe(3);