From 058d8ff80bf3b1f1744105f5f10fd6fbbbfbb9b1 Mon Sep 17 00:00:00 2001 From: Patryk Niedźwiedziński Date: Sun, 20 Oct 2019 22:25:48 +0200 Subject: Move to 'tests' --- tests/components/FacebookFeed.test.js | 11 ++++ tests/components/FacebookFindUsButton.test.js | 11 ++++ tests/components/Footer.test.js | 20 +++++++ tests/components/JoinUs.test.js | 11 ++++ tests/components/NavBar.test.js | 27 +++++++++ tests/components/NavLink.test.js | 23 ++++++++ .../__snapshots__/FacebookFeed.test.js.snap | 13 +++++ .../FacebookFindUsButton.test.js.snap | 19 +++++++ tests/components/__snapshots__/Footer.test.js.snap | 66 ++++++++++++++++++++++ tests/components/__snapshots__/JoinUs.test.js.snap | 31 ++++++++++ tests/components/__snapshots__/NavBar.test.js.snap | 40 +++++++++++++ .../components/__snapshots__/NavLink.test.js.snap | 14 +++++ 12 files changed, 286 insertions(+) create mode 100644 tests/components/FacebookFeed.test.js create mode 100644 tests/components/FacebookFindUsButton.test.js create mode 100644 tests/components/Footer.test.js create mode 100644 tests/components/JoinUs.test.js create mode 100644 tests/components/NavBar.test.js create mode 100644 tests/components/NavLink.test.js create mode 100644 tests/components/__snapshots__/FacebookFeed.test.js.snap create mode 100644 tests/components/__snapshots__/FacebookFindUsButton.test.js.snap create mode 100644 tests/components/__snapshots__/Footer.test.js.snap create mode 100644 tests/components/__snapshots__/JoinUs.test.js.snap create mode 100644 tests/components/__snapshots__/NavBar.test.js.snap create mode 100644 tests/components/__snapshots__/NavLink.test.js.snap (limited to 'tests/components') diff --git a/tests/components/FacebookFeed.test.js b/tests/components/FacebookFeed.test.js new file mode 100644 index 0000000..7abedf6 --- /dev/null +++ b/tests/components/FacebookFeed.test.js @@ -0,0 +1,11 @@ +import { shallowMount } from '@vue/test-utils' +import FacebookFeed from '../../components/FacebookFeed' + +describe('FacebookFeed', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(FacebookFeed) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/FacebookFindUsButton.test.js b/tests/components/FacebookFindUsButton.test.js new file mode 100644 index 0000000..d74e16f --- /dev/null +++ b/tests/components/FacebookFindUsButton.test.js @@ -0,0 +1,11 @@ +import { shallowMount } from '@vue/test-utils' +import FacebookFindUsButton from '../../components/FacebookFindUsButton' + +describe('FacebookFindUsButton', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(FacebookFindUsButton) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/Footer.test.js b/tests/components/Footer.test.js new file mode 100644 index 0000000..e284b5a --- /dev/null +++ b/tests/components/Footer.test.js @@ -0,0 +1,20 @@ +import { shallowMount } from '@vue/test-utils' +import Footer from '../../components/Footer' + +describe('Footer', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(Footer) + + wrapper.setProps({ + routes: [ + { + path: '/', + name: 'Home' + } + ] + }) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/JoinUs.test.js b/tests/components/JoinUs.test.js new file mode 100644 index 0000000..c831459 --- /dev/null +++ b/tests/components/JoinUs.test.js @@ -0,0 +1,11 @@ +import { shallowMount } from '@vue/test-utils' +import JoinUs from '../../components/JoinUs' + +describe('JoinUs', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(JoinUs) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/NavBar.test.js b/tests/components/NavBar.test.js new file mode 100644 index 0000000..be61915 --- /dev/null +++ b/tests/components/NavBar.test.js @@ -0,0 +1,27 @@ +import { shallowMount } from '@vue/test-utils' +import NavBar from '../../components/NavBar' + +describe('NavBar', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(NavBar) + + wrapper.setProps({ + title: 'Title', + routes: [ + { + path: '/', + name: 'Home' + } + ] + }) + + it('check title', () => { + expect(wrapper.html()).toContain( + 'Title' + ) + }) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/NavLink.test.js b/tests/components/NavLink.test.js new file mode 100644 index 0000000..d35e6db --- /dev/null +++ b/tests/components/NavLink.test.js @@ -0,0 +1,23 @@ +import { shallowMount } from '@vue/test-utils' +import NavLink from '../../components/NavLink' + +describe('NavLink', () => { + // Now mount the component and you have the wrapper + const wrapper = shallowMount(NavLink) + + wrapper.setProps({ link: '/link', name: 'Link' }) + + it('renders the correct markup', () => { + expect(wrapper.html()).toContain( + `` + ) + }) + + it('check text', () => { + expect(wrapper.text()).toBe('Link') + }) + + it('match snapshot', () => { + expect(wrapper.element).toMatchSnapshot() + }) +}) diff --git a/tests/components/__snapshots__/FacebookFeed.test.js.snap b/tests/components/__snapshots__/FacebookFeed.test.js.snap new file mode 100644 index 0000000..6819e12 --- /dev/null +++ b/tests/components/__snapshots__/FacebookFeed.test.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`FacebookFeed match snapshot 1`] = ` +
+

+ Zobacz co się dzieje! +

+ + +
+`; diff --git a/tests/components/__snapshots__/FacebookFindUsButton.test.js.snap b/tests/components/__snapshots__/FacebookFindUsButton.test.js.snap new file mode 100644 index 0000000..98783c4 --- /dev/null +++ b/tests/components/__snapshots__/FacebookFindUsButton.test.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`FacebookFindUsButton match snapshot 1`] = ` + +
+ Find us on Facebook +
+
+`; diff --git a/tests/components/__snapshots__/Footer.test.js.snap b/tests/components/__snapshots__/Footer.test.js.snap new file mode 100644 index 0000000..577f85e --- /dev/null +++ b/tests/components/__snapshots__/Footer.test.js.snap @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Footer match snapshot 1`] = ` +