|
|
@ -117,10 +117,12 @@ const formulaDataByDbType = (context: NcContext, index: number) => { |
|
|
|
{ |
|
|
|
{ |
|
|
|
formula: 'ROUNDDOWN({CityId} + 2.49, 1)', |
|
|
|
formula: 'ROUNDDOWN({CityId} + 2.49, 1)', |
|
|
|
result: ['3.4', '4.4', '5.4', '6.4', '7.4'], |
|
|
|
result: ['3.4', '4.4', '5.4', '6.4', '7.4'], |
|
|
|
|
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
formula: 'ROUNDUP({CityId} + 2.49, 1)', |
|
|
|
formula: 'ROUNDUP({CityId} + 2.49, 1)', |
|
|
|
result: ['3.5', '4.5', '5.5', '6.5', '7.5'], |
|
|
|
result: ['3.5', '4.5', '5.5', '6.5', '7.5'], |
|
|
|
|
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
formula: 'RECORD_ID()', |
|
|
|
formula: 'RECORD_ID()', |
|
|
@ -132,13 +134,11 @@ const formulaDataByDbType = (context: NcContext, index: number) => { |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: this is bug in mysql, its being case in-sensitive.
|
|
|
|
|
|
|
|
formula: 'REGEX_EXTRACT({City}, "a[a-z]a")', |
|
|
|
formula: 'REGEX_EXTRACT({City}, "a[a-z]a")', |
|
|
|
result: ['', '', '', '', 'ana'], |
|
|
|
result: ['', '', '', '', 'ana'], |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: this is bug in mysql, its being case in-sensitive.
|
|
|
|
|
|
|
|
formula: 'REGEX_REPLACE({City}, "a[a-z]a","...")', |
|
|
|
formula: 'REGEX_REPLACE({City}, "a[a-z]a","...")', |
|
|
|
result: ['A Corua (La Corua)', 'Abha', 'Abu Dhabi', 'Acua', 'Ad...'], |
|
|
|
result: ['A Corua (La Corua)', 'Abha', 'Abu Dhabi', 'Acua', 'Ad...'], |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
|
unSupDbType: ['sqlite3'], |
|
|
@ -277,9 +277,10 @@ test.describe('Virtual Columns', () => { |
|
|
|
type: 'Formula', |
|
|
|
type: 'Formula', |
|
|
|
formula: formulaData[i].formula, |
|
|
|
formula: formulaData[i].formula, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(`running test function: ${formulaData[i].formula}`); |
|
|
|
if (formulaData[i].unSupDbType?.includes(dbType)) { |
|
|
|
if (formulaData[i].unSupDbType?.includes(dbType)) { |
|
|
|
// assert for message not supported or greyed out save button.
|
|
|
|
// assert for message not supported or greyed out save button.
|
|
|
|
await dashboard.grid.column.saveFail({ errorMessage: 'Invalid Formula' }); |
|
|
|
await dashboard.grid.column.checkMessageAndClose({ errorMessage: new RegExp('Function .* is not available') }); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
await dashboard.grid.column.save({ isUpdated: true }); |
|
|
|
await dashboard.grid.column.save({ isUpdated: true }); |
|
|
|