add more VariablesDetail tests

This commit is contained in:
Keith Grant 2020-01-23 11:15:33 -08:00
parent 49907e337a
commit c6159a7c3e

View File

@ -63,4 +63,20 @@ describe('<VariablesDetail>', () => {
expect(input.prop('mode')).toEqual('javascript');
expect(input.prop('value')).toEqual('{\n "bar": "baz"\n}');
});
test('should default yaml value to "---"', () => {
const wrapper = shallow(<VariablesDetail value="" label="Variables" />);
const input = wrapper.find('Styled(CodeMirrorInput)');
expect(input.prop('value')).toEqual('---');
});
test('should default empty json to "{}"', () => {
const wrapper = mount(<VariablesDetail value="" label="Variables" />);
act(() => {
wrapper.find('YamlJsonToggle').invoke('onChange')('javascript');
});
wrapper.setProps({ value: '' });
const input = wrapper.find('Styled(CodeMirrorInput)');
expect(input.prop('value')).toEqual('{}');
});
});