|
4 | 4 | */ |
5 | 5 |
|
6 | 6 | import { mount, createLocalVue, shallowMount } from '@vue/test-utils' |
7 | | -import QBUTTON from './demo/QBtn-demo.vue' |
8 | 7 | import * as All from 'quasar' |
9 | | -// import langEn from 'quasar/lang/en-us' // change to any language you wish! => this breaks wallaby :( |
10 | 8 | const { Quasar, date } = All |
11 | 9 |
|
12 | | -const components = Object.keys(All).reduce((object, key) => { |
13 | | - const val = All[key] |
14 | | - if (val && val.component && val.component.name != null) { |
15 | | - object[key] = val |
| 10 | +import mutations from '../../../src/store/mutations'; |
| 11 | + |
| 12 | +describe('Test mutations to remove action from component and userActions', () => { |
| 13 | + const state = { |
| 14 | + componentMap: { |
| 15 | + component: { |
| 16 | + componentName: 'App', |
| 17 | + children: ['HomeView'], |
| 18 | + htmlList: [], |
| 19 | + mapActions: ['action'] |
| 20 | + } |
| 21 | + }, |
| 22 | + activeComponent: 'component', |
| 23 | + userActions: ['action'] |
16 | 24 | } |
17 | | - return object |
18 | | -}, {}) |
19 | 25 |
|
20 | | -describe('Dummy test', () => { |
21 | | - const localVue = createLocalVue() |
22 | | - localVue.use(Quasar, { components }) |
23 | | - const testValue = false; |
24 | | - it('does this produce the correct result', () => { |
25 | | - expect(testValue).toBe(false) |
| 26 | + it('deleting user action from state.userActions', () => { |
| 27 | + mutations.DELETE_USER_ACTIONS(state, 'action') |
| 28 | + expect(state.userActions.length).toBe(0); |
26 | 29 | }) |
27 | | -}) |
28 | 30 |
|
29 | | -describe('Test Suite - Delete from userActions and/or componentMap', () => { |
30 | | - const localVue = createLocalVue() |
31 | | - localVue.use(Quasar, { components }) |
32 | | - const testValue = false; |
33 | | - it('does this produce the correct result ahahaha', () => { |
34 | | - expect(testValue).toBe(false) |
| 31 | + it('deleting "action" from componentMap', () => { |
| 32 | + mutations.REMOVE_ACTION_FROM_COMPONENT(state, 'action'); |
| 33 | + expect(state.componentMap.component.mapActions.length).toBe(0) |
35 | 34 | }) |
36 | 35 | }) |
37 | 36 |
|
38 | | -// describe('Mount Quasar', () => { |
39 | | -// const localVue = createLocalVue() |
40 | | -// localVue.use(Quasar, { components }) // , lang: langEn |
41 | | - |
42 | | -// const wrapper = mount(QBUTTON, { |
43 | | -// localVue |
44 | | -// }) |
45 | | -// const vm = wrapper.vm |
46 | | - |
47 | | -// it('passes the sanity check and creates a wrapper', () => { |
48 | | -// expect(wrapper.isVueInstance()).toBe(true) |
49 | | -// }) |
50 | | - |
51 | | -// it('has a created hook', () => { |
52 | | -// expect(typeof vm.increment).toBe('function') |
53 | | -// }) |
54 | | - |
55 | | -// it('accesses the shallowMount', () => { |
56 | | -// expect(vm.$el.textContent).toContain('rocket muffin') |
57 | | -// expect(wrapper.text()).toContain('rocket muffin') // easier |
58 | | -// expect(wrapper.find('p').text()).toContain('rocket muffin') |
59 | | -// }) |
60 | | - |
61 | | -// it('sets the correct default data', () => { |
62 | | -// expect(typeof vm.counter).toBe('number') |
63 | | -// const defaultData2 = QBUTTON.data() |
64 | | -// expect(defaultData2.counter).toBe(0) |
65 | | -// }) |
66 | | - |
67 | | -// it('correctly updates data when button is pressed', () => { |
68 | | -// const button = wrapper.find('button') |
69 | | -// button.trigger('click') |
70 | | -// expect(vm.counter).toBe(1) |
71 | | -// }) |
72 | | - |
73 | | -// it('formats a date without throwing exception', () => { |
74 | | -// // test will automatically fail if an exception is thrown |
75 | | -// // MMMM and MMM require that a language is 'installed' in Quasar |
76 | | -// let formattedString = date.formatDate(Date.now(), 'YYYY MMMM MMM DD') |
77 | | -// console.log('formattedString', formattedString) |
78 | | -// }) |
79 | | -// }) |
0 commit comments