Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to shallowmount with vue component #7413

Closed
Kishor-Kumar-Namdeo opened this issue Nov 26, 2018 · 2 comments
Closed

unable to shallowmount with vue component #7413

Kishor-Kumar-Namdeo opened this issue Nov 26, 2018 · 2 comments

Comments

@Kishor-Kumar-Namdeo
Copy link

Hi, i am using @vue/cli-plugin-unit-jest : "^3.1.1" and when i run src/view/* component test script file then shallowMount working fine but when i run src/components/* component test script file then its show bellow error. please help me to solve such issue. my component & test file content are below....

register.vue




    
        
            

REGISTER

Name Field should be minimum 3 letters

Enter valid email address

Password should be minimum 6 digit

Password and confirm password should be same

REGISTER

Already have an account? Log In

<script> import { required, minLength, maxLength, email, sameAs } from 'vuelidate/lib/validators' import { REGISTER_WITH_EMAIL_PASSWORD, UPDATE_USER_NAME, UPDATE_USER_PHOTO } from '../../../../resource/firebase' import EventBus from '../../../../helpers/event-bus' export default { name: 'Register', data () { return { user: { email: '', password: '', confirm_password: '', name: '' } } }, validations: { user: { name: { required, minLength: minLength(3), maxLength: maxLength(40) }, email: { required, email }, password: { required, minLength: minLength(6) }, confirm_password: { sameAsPassword: sameAs('password') } } }, methods: { registerUser () { this.$v.user.$touch() if (this.$v.user.$invalid) { return false } EventBus.$emit('pageLoading', true) REGISTER_WITH_EMAIL_PASSWORD({ email: this.user.email, password: this.user.password }, (data) => { // console.log(data) this.updateDetails() }, (error) => { EventBus.$emit('pageLoading', false) // console.log(error) this.$swal({ type: 'error', title: error.message, showConfirmButton: false, timer: 1500 }) }) }, async updateDetails () { let photo = process.env.VUE_APP_BASE_URL + '/images/default_user.png' await UPDATE_USER_NAME(this.user.name) await UPDATE_USER_PHOTO(photo) EventBus.$emit('pageLoading', false) this.$emit('changeModal', 'login') this.$swal({ position: 'top-end', type: 'success', title: 'Your Account created successfully.... Please Login', showConfirmButton: false, timer: 2000 }) } } } </script>

register.spec.js

import { shallowMount } from '@vue/test-utils'
import Register from '@/components/commons/modals/auth/Register.vue'

describe('Register', () => {
it('check login with email & password', () => {
console.log('dsfasfsd');
const wrapper = shallowMount(Register, {
data() {
return{
user: {
email: '[email protected]',
password: 'test123',
confirm_password: 'test123',
name: 'unit test'
}
}
}
})
})
})


error while run test
screenshot_2018-11-26_18-01-48

@thymikee
Copy link
Collaborator

thymikee commented Nov 26, 2018

This is likely problem with @vue/cli-plugin-unit-jest. Please send them this issue.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants