Skip to content

Instantly share code, notes, and snippets.

@mfaridzia
Created March 16, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfaridzia/c9b4fe8f6cf5c7719091a99013b4987b to your computer and use it in GitHub Desktop.
Save mfaridzia/c9b4fe8f6cf5c7719091a99013b4987b to your computer and use it in GitHub Desktop.
import { shallowMount } from '@vue/test-utils'
import TestComponent from '@/components/TestComponent.vue'
describe('TestComponent.vue', () => {
it('Merender judul text', () => {
const wrapper = shallowMount(TestComponent, {
data() {
return {
title: 'Input Data'
}
}
})
expect(wrapper.find('.title').text()).toEqual('Input Data')
})
it('Menampilkan pesan ketika data sudah di submit', () => {
const wrapper = shallowMount(TestComponent)
wrapper.find(".name").setValue("fulana")
wrapper.find("button").trigger("click")
expect(wrapper.find(".success").text()).toBe("Thank You fulana")
})
it("Menampilkan pesan fulana jika isFulana bernilai true", () => {
const wrapper = shallowMount(TestComponent, {
propsData: {
isFulana: true
}
})
console.log(wrapper.html())
expect(wrapper.find("h2").text()).toBe("Ente Fulana Euy!")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment