From 40c2aada155f1c4302ac26034443acea82760f29 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Fri, 9 Dec 2022 14:15:55 +0800 Subject: [PATCH] feat(playwright): formula DATETIME_DIFF tests --- tests/playwright/tests/columnFormula.spec.ts | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/tests/playwright/tests/columnFormula.spec.ts b/tests/playwright/tests/columnFormula.spec.ts index d9a1ed5763..b8c5fdcc8a 100644 --- a/tests/playwright/tests/columnFormula.spec.ts +++ b/tests/playwright/tests/columnFormula.spec.ts @@ -30,6 +30,46 @@ const formulaDataByDbType = (context: NcContext) => [ formula: `WEEKDAY("2022-07-19", "sunday")`, result: ['2', '2', '2', '2', '2'], }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15")`, + result: ['-86400', '-86400', '-86400', '-86400', '-86400'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "minutes")`, + result: ['-1440', '-1440', '-1440', '-1440', '-1440'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "seconds")`, + result: ['-86400', '-86400', '-86400', '-86400', '-86400'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "milliseconds")`, + result: ['-86400000', '-86400000', '-86400000', '-86400000', '-86400000'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "hours")`, + result: ['-24', '-24', '-24', '-24', '-24'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "weeks")`, + result: ['-52', '-52', '-52', '-52', '-52'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "months")`, + result: ['-12', '-12', '-12', '-12', '-12'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "Q")`, + result: ['-4', '-4', '-4', '-4', '-4'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "y")`, + result: ['-1', '-1', '-1', '-1', '-1'], + }, + { + formula: `DATETIME_DIFF("2022/10/14", "2022/10/15", "d")`, + result: ['-365', '-365', '-365', '-365', '-365'], + }, { formula: `CONCAT(UPPER({City}), LOWER({City}), TRIM(' trimmed '))`, result: [