|
| 1 | +import { shallowMount } from '@vue/test-utils'; |
| 2 | +import { localVueMock, routerMock } from '@mocks/router'; |
| 3 | +import demo from '@scripts/components/demo/demo'; |
| 4 | +import intro from './intro'; |
| 5 | + |
| 6 | +describe('Intro', () => { |
| 7 | + function mountComponent(){ |
| 8 | + return shallowMount(intro, { |
| 9 | + localVue: localVueMock, |
| 10 | + router: routerMock |
| 11 | + }); |
| 12 | + } |
| 13 | + |
| 14 | + it('should have appropriate css classes', () => { |
| 15 | + const wrapper = mountComponent(); |
| 16 | + expect(wrapper.classes()).toEqual(['intro']); |
| 17 | + }); |
| 18 | + |
| 19 | + it('should contain a heading', () => { |
| 20 | + const wrapper = mountComponent(); |
| 21 | + expect(wrapper.find('h1').text()).toEqual('Simplicidade deslumbrante.'); |
| 22 | + }); |
| 23 | + |
| 24 | + it('should contain a paragraph', () => { |
| 25 | + const wrapper = mountComponent(); |
| 26 | + expect(wrapper.find('p').text()).toEqual('Consulte endereços postais da maneira mais fácil que você já viu.'); |
| 27 | + }); |
| 28 | + |
| 29 | + it('should contain a button', () => { |
| 30 | + const wrapper = mountComponent(); |
| 31 | + expect(wrapper.find(demo)).toBeDefined(); |
| 32 | + expect(wrapper.find('btn-stub').text()).toEqual('Experimente'); |
| 33 | + }); |
| 34 | + |
| 35 | + it('should contain a demo', () => { |
| 36 | + const wrapper = mountComponent(); |
| 37 | + expect(wrapper.find(demo)).toBeDefined(); |
| 38 | + }); |
| 39 | +}); |
0 commit comments