From afa0acb63ec9009b1d9d1b91b362ec23aba3d74c Mon Sep 17 00:00:00 2001 From: Jared Scheib Date: Wed, 14 Mar 2018 16:06:34 -0700 Subject: [PATCH] Add initial passing enzyme test for KapacitorRules render --- .../components/KapacitorRules.test.tsx | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 ui/test/kapacitor/components/KapacitorRules.test.tsx diff --git a/ui/test/kapacitor/components/KapacitorRules.test.tsx b/ui/test/kapacitor/components/KapacitorRules.test.tsx new file mode 100644 index 0000000000..733571bf7b --- /dev/null +++ b/ui/test/kapacitor/components/KapacitorRules.test.tsx @@ -0,0 +1,39 @@ +import React from 'react' +import {shallow} from 'enzyme' + +import KapacitorRules from 'src/kapacitor/components/KapacitorRules' + +import {source, kapacitorRules} from 'test/resources' + +jest.mock('src/shared/apis', () => require('mocks/shared/apis')) + +const setup = (override = {}) => { + const props = { + source, + rules: kapacitorRules, + hasKapacitor: true, + loading: false, + onDelete: () => {}, + onChangeRuleStatus: () => {}, + } + + const wrapper = shallow() + + return { + wrapper, + props, + } +} + +describe('Kapacitor.Containers.KapacitorRules', () => { + afterEach(() => { + jest.clearAllMocks() + }) + + describe('rendering', () => { + it('renders the KapacitorRules', () => { + const {wrapper} = setup() + expect(wrapper.exists()).toBe(true) + }) + }) +})