From f440e1404eb7a62d69b46cd85bc5df8e2140ea25 Mon Sep 17 00:00:00 2001 From: Ganjar Setia M Date: Wed, 26 Feb 2020 20:26:54 +0700 Subject: [PATCH] test: add CChartBarExample unit test (#193) --- .../views/charts/CChartBarExample.spec.js | 29 +++++++++++++++++++ .../CChartBarExample.spec.js.snap | 8 +++++ 2 files changed, 37 insertions(+) create mode 100644 tests/unit/views/charts/CChartBarExample.spec.js create mode 100644 tests/unit/views/charts/__snapshots__/CChartBarExample.spec.js.snap diff --git a/tests/unit/views/charts/CChartBarExample.spec.js b/tests/unit/views/charts/CChartBarExample.spec.js new file mode 100644 index 00000000..15d246b0 --- /dev/null +++ b/tests/unit/views/charts/CChartBarExample.spec.js @@ -0,0 +1,29 @@ +import Vue from 'vue' +import { shallowMount } from '@vue/test-utils'; +import CoreuiVue from '@coreui/vue' +import CChartBarExample from '@/views/charts/CChartBarExample' + +Vue.use(CoreuiVue) + +describe('CChartBarExample', () => { + it('has a name', () => { + expect(CChartBarExample.name).toBe('CChartBarExample') + }) + it('is Vue instance', () => { + const wrapper = shallowMount(CChartBarExample) + expect(wrapper.isVueInstance()).toBe(true) + }) + it('is CChartBarExample', () => { + const wrapper = shallowMount(CChartBarExample) + expect(wrapper.is(CChartBarExample)).toBe(true) + }) + test('renders correctly', () => { + const wrapper = shallowMount(CChartBarExample) + expect(wrapper.element).toMatchSnapshot() + }) + it('should have computed', () => { + const wrapper = shallowMount(CChartBarExample) + + expect(wrapper.vm.defaultDatasets).toBeDefined() + }) +}) diff --git a/tests/unit/views/charts/__snapshots__/CChartBarExample.spec.js.snap b/tests/unit/views/charts/__snapshots__/CChartBarExample.spec.js.snap new file mode 100644 index 00000000..70d0244c --- /dev/null +++ b/tests/unit/views/charts/__snapshots__/CChartBarExample.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`CChartBarExample renders correctly 1`] = ` + +`;