Skip to content

Instantly share code, notes, and snippets.

@laiso
Created October 14, 2020 17:14
Show Gist options
  • Select an option

  • Save laiso/49d739eb224c0d34831b1762fd2f9e44 to your computer and use it in GitHub Desktop.

Select an option

Save laiso/49d739eb224c0d34831b1762fd2f9e44 to your computer and use it in GitHub Desktop.
こんな感じの雛形を用意して useCounter 部分のテストを書くことにした #CodePiece
import {shallowMount} from '@vue/test-utils'
import {useCounter} from "@/composables/counter";
const Example = {
setup() {
return {
...useCounter(0),
}
},
template: `example`,
}
describe('Example', () => {
it('render Example', () => {
const wrapper = shallowMount(Example);
wrapper.vm.increment()
expect(wrapper.vm.count).toBe(1)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment