Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
variables
/
shared
/
File Content:
multiOptions.test.ts
import { VariableOption } from 'app/features/variables/types'; import { alignCurrentWithMulti } from './multiOptions'; describe('alignCurrentWithMulti', () => { describe('when current has string array values and multi is false', () => { it('should return current without string arrays', () => { const current: VariableOption = { value: ['A'], text: ['A'], selected: false, }; const next = alignCurrentWithMulti(current, false); expect(next).toEqual({ value: 'A', text: 'A', selected: false, }); }); }); describe('when current has string values and multi is true', () => { it('should return current with string arrays', () => { const current: VariableOption = { value: 'A', text: 'A', selected: false, }; const next = alignCurrentWithMulti(current, true); expect(next).toEqual({ value: ['A'], text: ['A'], selected: false, }); }); }); describe('when current has string values and multi is false', () => { it('should return current without string arrays', () => { const current: VariableOption = { value: 'A', text: 'A', selected: false, }; const next = alignCurrentWithMulti(current, false); expect(next).toEqual({ value: 'A', text: 'A', selected: false, }); }); }); describe('when current has string array values and multi is true', () => { it('should return current with string arrays', () => { const current: VariableOption = { value: ['A'], text: ['A'], selected: false, }; const next = alignCurrentWithMulti(current, true); expect(next).toEqual({ value: ['A'], text: ['A'], selected: false, }); }); }); });
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
testing
---
0755
formatVariable.ts
618 bytes
0644
multiOptions.test.ts
1884 bytes
0644
multiOptions.ts
910 bytes
0644
N4ST4R_ID | Naxtarrr