1
0
mirror of https://gitlab.com/bramw/baserow.git synced 2024-11-25 00:46:46 +00:00
bramw_baserow/web-frontend/test/unit/formula/formulaParser.spec.js
2023-09-04 12:17:41 +00:00

25 lines
741 B
JavaScript

import parseBaserowFormula from '@baserow/modules/core/formula/parser/parser'
import { BaserowFormulaParserError } from '@baserow/modules/core/formula/parser/errors'
describe('Baserow Formula Tests', () => {
const validFormulas = ["lower('test')", "upper('test')"]
const invalidFormulas = [
['a', BaserowFormulaParserError],
['12ssda3', BaserowFormulaParserError],
]
test.each(validFormulas)(
'valid baserow formulas do not raise a parser error',
(value) => {
expect(parseBaserowFormula(value)).toBeTruthy()
}
)
test.each(invalidFormulas)(
'invalid baserow formulas raise a parser error',
(value, exception) => {
expect(() => parseBaserowFormula(value)).toThrow(exception)
}
)
})