Created
October 14, 2020 17:14
-
-
Save laiso/49d739eb224c0d34831b1762fd2f9e44 to your computer and use it in GitHub Desktop.
こんな感じの雛形を用意して useCounter 部分のテストを書くことにした #CodePiece
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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