Skip to content

Commit

Permalink
Merge pull request #460 from j4ckofalltrades/issue-124/add-tests-for-…
Browse files Browse the repository at this point in the history
…error-page

Add tests for the ErrorPage view
  • Loading branch information
jayehernandez authored Oct 19, 2020
2 parents 9878082 + be99257 commit 94489b9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion client/src/views/ErrorPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.center-container.fadeIn(v-wow data-wow-duration="1s")
h1 oops!
.quote-container.sentence
| An error occured.
| An error occurred.
br
| Please go to the
a.is-text-primary.is-underlined(:href="webstoreLink") {{ webstoreText }}
Expand Down
28 changes: 28 additions & 0 deletions client/test/src/views/ErrorPage.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { shallowMount, createLocalVue } from '@vue/test-utils';
import ErrorPage from '../../../src/views/ErrorPage';

const localVue = createLocalVue();
localVue.directive('wow', { bind() { }, unbind() { } })

describe('ErrorPage', () => {
const wrapper = shallowMount(ErrorPage, { localVue });

it('is a Vue instance', () => {
expect(wrapper.vm).toBeTruthy();
});

it('displays an error message', () => {
const errorMessageSelector = '.quote-container'
const errorMessage = wrapper.find(errorMessageSelector).text()

expect(errorMessage).toContain('An error occurred.');
expect(errorMessage).toContain('Please go to the support tab of the extension if this continues!');
});

it('links to the Letra extension in the web store', () => {
const webStoreLinkSelector = 'a.is-text-primary.is-underlined'

expect(wrapper.find(webStoreLinkSelector).attributes().href)
.toBe('https://chrome.google.com/webstore/detail/letra/cjodkkjokggcaeacdhjliobekbnnmoio')
});
});

0 comments on commit 94489b9

Please sign in to comment.