From 44595aa2f4a2cd5690686ba87ee7d70ef0de5bb3 Mon Sep 17 00:00:00 2001 From: Davis Plumlee Date: Wed, 21 Oct 2020 17:28:15 -0600 Subject: [PATCH] adds new tests i guess --- .../pages/detection_engine/rules/helpers.test.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx index df1ab47771867c..a327f8498f7c0b 100644 --- a/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules/helpers.test.tsx @@ -306,12 +306,24 @@ describe('rule helpers', () => { expect(result).toEqual('2s'); }); + test('returns from as seconds if from duration is specified in seconds greater than 60', () => { + const result = getHumanizedDuration('now-122s', '1m'); + + expect(result).toEqual('62s'); + }); + test('returns from as minutes if from duration is specified in minutes', () => { const result = getHumanizedDuration('now-660s', '5m'); expect(result).toEqual('6m'); }); + test('returns from as minutes if from duration is specified in minutes greater than 60', () => { + const result = getHumanizedDuration('now-6600s', '5m'); + + expect(result).toEqual('105m'); + }); + test('returns from as hours if from duration is specified in hours', () => { const result = getHumanizedDuration('now-7500s', '5m');