Skip to content

Instantly share code, notes, and snippets.

@vicainelli
Created April 27, 2020 15:03
Show Gist options
  • Save vicainelli/cf7599577ee995dec5b0233f5c29da9e to your computer and use it in GitHub Desktop.
Save vicainelli/cf7599577ee995dec5b0233f5c29da9e to your computer and use it in GitHub Desktop.
setProps vue-test-utils
import { shallowMount } from '@vue/test-utils'
import ItemAddress from '@/components/molecules/ItemAddress'
describe('ItemAddress', () => {
let wrapper
beforeEach(() => {
wrapper = shallowMount(ItemAddress, {
propsData: {
icon: false
}
})
})
afterEach(() => {
wrapper.destroy()
})
test('Se não existe a tag img', () => {
expect(wrapper.find('img').exists()).toBe(false)
})
test('Se existe a tag img', () => {
wrapper.setProps({ icon: true })
expect(wrapper.find('img').exists()).toBe(true)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment