Add test for defaultRP in the UI on SourceForm
Co-authored-by Iris Scholten <ischolten.is@gmail.com>pull/3233/head
parent
8b807670fe
commit
61914a6431
|
@ -8,7 +8,7 @@ import {insecureSkipVerifyText} from 'shared/copy/tooltipText'
|
|||
|
||||
import {SUPERADMIN_ROLE} from 'src/auth/Authorized'
|
||||
|
||||
const SourceForm = ({
|
||||
export const SourceForm = ({
|
||||
source,
|
||||
editMode,
|
||||
onSubmit,
|
||||
|
|
|
@ -13,6 +13,7 @@ export interface Source {
|
|||
links: SourceLinks
|
||||
kapacitors?: Kapacitor[]
|
||||
metaUrl?: string
|
||||
defaultRP: string
|
||||
}
|
||||
|
||||
interface SourceLinks {
|
||||
|
|
|
@ -40,6 +40,7 @@ export const source = {
|
|||
telegraf: 'telegraf',
|
||||
organization: '0',
|
||||
role: 'viewer',
|
||||
defaultRP: '',
|
||||
links,
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import React from 'react'
|
||||
import {shallow} from 'enzyme'
|
||||
|
||||
import {SourceForm} from 'src/sources/components/SourceForm'
|
||||
|
||||
const setup = (override = {}) => {
|
||||
const noop = () => {}
|
||||
const props = {
|
||||
source: {
|
||||
url: '',
|
||||
name: '',
|
||||
username: '',
|
||||
password: '',
|
||||
telegraf: '',
|
||||
insecureSkipVerify: false,
|
||||
default: false,
|
||||
metaUrl: '',
|
||||
},
|
||||
editMode: false,
|
||||
onSubmit: noop,
|
||||
onInputChange: noop,
|
||||
onBlurSourceURL: noop,
|
||||
isUsingAuth: false,
|
||||
gotoPurgatory: noop,
|
||||
isInitialSource: false,
|
||||
me: {},
|
||||
...override,
|
||||
}
|
||||
|
||||
const wrapper = shallow(<SourceForm {...props} />)
|
||||
return {wrapper, props}
|
||||
}
|
||||
|
||||
describe('Sources.Components.SourceForm', () => {
|
||||
describe('rendering', () => {
|
||||
it('renders default retention policy field', () => {
|
||||
const {wrapper} = setup()
|
||||
const inputs = wrapper.find('input')
|
||||
const defaultRP = inputs.find({id: 'defaultRP'})
|
||||
|
||||
expect(defaultRP.exists()).toBe(true)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue