From 2adb05879534b216eeedd62a5e3c2cab221ae129 Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Sat, 4 Feb 2023 12:48:53 +0530 Subject: [PATCH] test: filter for duration column Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../tests/unit/rest/tests/filter.test.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/tests/unit/rest/tests/filter.test.ts b/packages/nocodb/tests/unit/rest/tests/filter.test.ts index cdcbd75b93..315fe226ab 100644 --- a/packages/nocodb/tests/unit/rest/tests/filter.test.ts +++ b/packages/nocodb/tests/unit/rest/tests/filter.test.ts @@ -25,7 +25,11 @@ async function retrieveRecordsAndValidate( ) { let expectedRecords = []; let toFloat = false; - if (['Number', 'Decimal', 'Currency', 'Percent', 'Rating'].includes(title)) { + if ( + ['Number', 'Decimal', 'Currency', 'Percent', 'Duration', 'Rating'].includes( + title + ) + ) { toFloat = true; } @@ -431,6 +435,20 @@ function filterNumberBased() { await verifyFilters('Percent', columns[4].id, filterList); }); + it('Type: Duration', async () => { + let filterList = [ + { comparison_op: 'eq', value: '10' }, + { comparison_op: 'neq', value: '10' }, + { comparison_op: 'null', value: '' }, + { comparison_op: 'notnull', value: '' }, + { comparison_op: 'gt', value: '50' }, + { comparison_op: 'gte', value: '50' }, + { comparison_op: 'lt', value: '50' }, + { comparison_op: 'lte', value: '50' }, + ]; + await verifyFilters('Duration', columns[5].id, filterList); + }); + it('Type: Rating', async () => { let filterList = [ { comparison_op: 'eq', value: '3' },