From 1151e8521e0300c68c27fd0f5f019b6f2020472a Mon Sep 17 00:00:00 2001 From: palashgdev Date: Wed, 8 Feb 2023 12:58:53 +0530 Subject: [PATCH] test: traceGraphFilter/utils selectedGroupByValue is added (#2201) Co-authored-by: Vishal Sharma --- .../Trace/TraceGraphFilter/utils.test.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 frontend/src/container/Trace/TraceGraphFilter/utils.test.ts diff --git a/frontend/src/container/Trace/TraceGraphFilter/utils.test.ts b/frontend/src/container/Trace/TraceGraphFilter/utils.test.ts new file mode 100644 index 0000000000..24787194b3 --- /dev/null +++ b/frontend/src/container/Trace/TraceGraphFilter/utils.test.ts @@ -0,0 +1,27 @@ +import { selectedGroupByValue } from './utils'; + +const options = [ + { + value: '1', + label: '1', + }, + { + value: '2', + label: '2', + }, +]; + +describe('TraceGraphFilter/utils', () => { + it('should return the correct value', () => { + const selectedGroupBy = '1'; + const result = selectedGroupByValue(selectedGroupBy, options); + expect(result).toEqual(selectedGroupBy); + }); + + it('should return the correct value when selectedOption not found', () => { + const selectedGroupBy = '3'; + + const result = selectedGroupByValue(selectedGroupBy, options); + expect(result).toEqual(selectedGroupBy); + }); +});