fix(ui/kapacitor): remove tests for TICKscript on Alert Rules page
parent
8ed746a3ce
commit
3e0a7a9d85
|
@ -17,9 +17,6 @@ describe('Kapacitor.Containers.KapacitorRules', () => {
|
||||||
loading: false,
|
loading: false,
|
||||||
onDelete: () => {},
|
onDelete: () => {},
|
||||||
onChangeRuleStatus: () => {},
|
onChangeRuleStatus: () => {},
|
||||||
fluxTasks: null,
|
|
||||||
onChangeFluxTaskStatus: () => undefined,
|
|
||||||
onDeleteFluxTask: () => undefined,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('rendering', () => {
|
describe('rendering', () => {
|
||||||
|
@ -29,24 +26,17 @@ describe('Kapacitor.Containers.KapacitorRules', () => {
|
||||||
expect(wrapper.exists()).toBe(true)
|
expect(wrapper.exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders KapacitorRulesTable', () => {
|
it('renders KapacitorRulesTable without', () => {
|
||||||
const wrapper = shallow(<KapacitorRules {...props} />)
|
const wrapper = shallow(<KapacitorRules {...props} />)
|
||||||
|
|
||||||
const kapacitorRulesTable = wrapper.find(KapacitorRulesTable)
|
const kapacitorRulesTable = wrapper.find(KapacitorRulesTable)
|
||||||
expect(kapacitorRulesTable.length).toEqual(1)
|
expect(kapacitorRulesTable.length).toEqual(1)
|
||||||
|
|
||||||
const tasksTable = wrapper.find(TasksTable)
|
const tasksTable = wrapper.find(TasksTable)
|
||||||
expect(tasksTable.length).toEqual(1)
|
expect(tasksTable.length).toEqual(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders TasksTable', () => {
|
describe('rows in KapacitorRulesTable', () => {
|
||||||
const wrapper = shallow(<KapacitorRules {...props} />)
|
|
||||||
|
|
||||||
const tasksTable = wrapper.find(TasksTable)
|
|
||||||
expect(tasksTable.length).toEqual(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('rows in KapacitorRulesTable and TasksTable', () => {
|
|
||||||
const findRows = (root, reactTable) =>
|
const findRows = (root, reactTable) =>
|
||||||
root
|
root
|
||||||
.find(reactTable)
|
.find(reactTable)
|
||||||
|
@ -84,59 +74,23 @@ describe('Kapacitor.Containers.KapacitorRules', () => {
|
||||||
|
|
||||||
let wrapper
|
let wrapper
|
||||||
let rulesRows
|
let rulesRows
|
||||||
let tasksRows
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = shallow(<KapacitorRules {...props} />)
|
wrapper = shallow(<KapacitorRules {...props} />)
|
||||||
rulesRows = findRows(wrapper, KapacitorRulesTable)
|
rulesRows = findRows(wrapper, KapacitorRulesTable)
|
||||||
tasksRows = findRows(wrapper, TasksTable)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders every rule/task checkbox with unique html id', () => {
|
it('renders every rule checkbox with unique html id', () => {
|
||||||
const allCheckboxIDs = rulesRows
|
const allCheckboxIDs = rulesRows.map(r => r.row.checkbox.id)
|
||||||
.map(r => r.row.checkbox.id)
|
|
||||||
.concat(tasksRows.map(r => r.row.checkbox.id))
|
|
||||||
|
|
||||||
expect(containsAnyDuplicate(allCheckboxIDs)).toEqual(false)
|
expect(containsAnyDuplicate(allCheckboxIDs)).toEqual(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders each rule/task table row label with unique "for" attribute', () => {
|
it('renders each rule table row label with unique "for" attribute', () => {
|
||||||
const allCheckboxLabelFors = rulesRows
|
const allCheckboxLabelFors = rulesRows.map(r => r.row.label.htmlFor)
|
||||||
.map(r => r.row.label.htmlFor)
|
|
||||||
.concat(tasksRows.map(r => r.row.label.htmlFor))
|
|
||||||
|
|
||||||
expect(containsAnyDuplicate(allCheckboxLabelFors)).toEqual(false)
|
expect(containsAnyDuplicate(allCheckboxLabelFors)).toEqual(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders one corresponding task row for each rule row', () => {
|
|
||||||
expect(rulesRows.length).toBeLessThanOrEqual(tasksRows.length)
|
|
||||||
|
|
||||||
rulesRows.forEach(ruleRow => {
|
|
||||||
expect(
|
|
||||||
tasksRows.filter(taskRow => taskRow.rule.id === ruleRow.rule.id)
|
|
||||||
.length
|
|
||||||
).toEqual(1)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('renders corresponding rule/task rows with the same enabled status', () => {
|
|
||||||
const correspondingRows = []
|
|
||||||
|
|
||||||
rulesRows.forEach(ruleRow => {
|
|
||||||
const taskRow = tasksRows
|
|
||||||
.filter(t => t.rule.id === ruleRow.rule.id)
|
|
||||||
.pop()
|
|
||||||
if (taskRow) {
|
|
||||||
correspondingRows.push({ruleRow, taskRow})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
correspondingRows.forEach(({ruleRow, taskRow}) => {
|
|
||||||
expect(ruleRow.row.checkbox.checked).toEqual(
|
|
||||||
taskRow.row.checkbox.checked
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue