fix test for Settings.vue

This commit is contained in:
ogerly 2022-11-26 10:47:49 +01:00
parent 5cd847507f
commit d02b9ab52d
2 changed files with 46 additions and 7 deletions

View File

@ -69,15 +69,12 @@ export default {
} }
}, },
methods: { methods: {
submit() { // updateTransactions(pagination) {
// console.log('submit') // this.$emit('update-transactions', pagination)
}, // },
updateTransactions(pagination) {
this.$emit('update-transactions', pagination)
},
}, },
created() { created() {
this.updateTransactions(0) // this.updateTransactions(0)
}, },
} }
</script> </script>

View File

@ -0,0 +1,42 @@
import { shallowMount } from '@vue/test-utils'
import Settings from './Settings'
const localVue = global.localVue
describe('Settings', () => {
let wrapper
const mocks = {
$t: jest.fn((t) => t),
}
const Wrapper = () => {
return shallowMount(Settings, { localVue, mocks })
}
describe('shallow Mount', () => {
beforeEach(() => {
wrapper = Wrapper()
})
it('has a user card', () => {
expect(wrapper.findComponent({ name: 'UserCard' }).exists()).toBeTruthy()
})
it('has a user first and last name form', () => {
expect(wrapper.findComponent({ name: 'UserData' }).exists()).toBeTruthy()
})
it('has a user change language form', () => {
expect(wrapper.findComponent({ name: 'UserLanguage' }).exists()).toBeTruthy()
})
it('has a user change password form', () => {
expect(wrapper.findComponent({ name: 'UserPassword' }).exists()).toBeTruthy()
})
it('has a user change newsletter form', () => {
expect(wrapper.findComponent({ name: 'UserNewsletter' }).exists()).toBeTruthy()
})
})
})