diff --git a/tests/e2e/specs/test.js b/tests/e2e/specs/test.js index e6c9471..6bd2b67 100644 --- a/tests/e2e/specs/test.js +++ b/tests/e2e/specs/test.js @@ -3,6 +3,6 @@ describe('My First Test', () => { it('Visits the app root url', () => { cy.visit('/'); - cy.contains('h1', 'Welcome to Your Vue.js App'); + cy.contains('h1', 'Memory Game'); }); }); diff --git a/tests/unit/Card.spec.js b/tests/unit/Card.spec.js new file mode 100644 index 0000000..e0307e4 --- /dev/null +++ b/tests/unit/Card.spec.js @@ -0,0 +1,28 @@ +import { shallowMount } from '@vue/test-utils'; +import Card from '@/components/Card.vue'; + +describe('Card.vue', () => { + const wrapper = shallowMount(Card, { + propsData: { + firstUuid: null, + name: 'ace of spades', + isMatched: false, + secondUuid: null, + showAll: false, + slug: 'ace-of-spades', + uuid: 'unique-string-1234', + }, + }); + + it('has a button', () => { + expect(wrapper.contains('button')).toBe(true); + }); + + it('render the back of the card', () => { + expect(wrapper.contains('.back img')).toBe(true); + }); + + it('render the front of the card', () => { + expect(wrapper.contains('.front img')).toBe(true); + }); +}); diff --git a/tests/unit/Header.spec.js b/tests/unit/Header.spec.js new file mode 100644 index 0000000..7361bf9 --- /dev/null +++ b/tests/unit/Header.spec.js @@ -0,0 +1,9 @@ +import { shallowMount } from '@vue/test-utils'; +import Header from '@/components/Header.vue'; + +describe('Header.vue', () => { + it('renders the page title', () => { + const wrapper = shallowMount(Header); + expect(wrapper.find('h1').text()).toMatch('Memory Game'); + }); +}); diff --git a/tests/unit/Win.spec.js b/tests/unit/Win.spec.js new file mode 100644 index 0000000..0d94d97 --- /dev/null +++ b/tests/unit/Win.spec.js @@ -0,0 +1,9 @@ +import { shallowMount } from '@vue/test-utils'; +import Win from '@/components/Win.vue'; + +describe('Win.vue', () => { + it('renders the win message', () => { + const wrapper = shallowMount(Win); + expect(wrapper.find('p').text()).toMatch('Winner! 🎊'); + }); +}); diff --git a/tests/unit/example.spec.js b/tests/unit/example.spec.js deleted file mode 100644 index 1cc67dc..0000000 --- a/tests/unit/example.spec.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import Vuex from 'vuex'; -import App from '@/App.vue'; - -const localVue = createLocalVue(); - -localVue.use(Vuex); - -describe('App.vue', () => { - it('renders props.msg when passed', () => { - const msg = 'App'; - const wrapper = shallowMount(App, { - propsData: { msg }, - }); - expect(wrapper.text()).toMatch(msg); - }); -});