Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cy-by committed Jan 22, 2020
1 parent 017d93e commit 847cc17
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/specs/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});
28 changes: 28 additions & 0 deletions tests/unit/Card.spec.js
Original file line number Diff line number Diff line change
@@ -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);
});
});
9 changes: 9 additions & 0 deletions tests/unit/Header.spec.js
Original file line number Diff line number Diff line change
@@ -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');
});
});
9 changes: 9 additions & 0 deletions tests/unit/Win.spec.js
Original file line number Diff line number Diff line change
@@ -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! 🎊');
});
});
17 changes: 0 additions & 17 deletions tests/unit/example.spec.js

This file was deleted.

0 comments on commit 847cc17

Please sign in to comment.