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); + }); +});