Skip to content

docs: vuex #41

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

Merged
merged 3 commits into from
Jul 22, 2020
Merged

docs: vuex #41

merged 3 commits into from
Jul 22, 2020

Conversation

lmiller1990
Copy link
Member

@lmiller1990 lmiller1990 commented Jul 21, 2020

Quick one, feel like I've written a "how to test vuex" article quite a few times by this point. We can make this more longer and detailed in the future if need be! Just trying to get something basic for each section before Vue 3 is official released.

resolves #8

@lmiller1990 lmiller1990 mentioned this pull request Jul 21, 2020
@lmiller1990 lmiller1990 requested a review from afontcu July 21, 2020 12:05
```

The [Vue Testing Handbook](https://lmiller1990.github.io/vue-testing-handbook/testing-vuex.html) has more examples for testing Vuex. Note: the examples pertain to Vue.js 2 and Vue Test Utils v1. The ideas and concepts are the same, and the Vue Testing Handbook will be updated for Vue.js 3 and Vue Test Utils 2 in the near future.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to plug my own guide lol. I will have it up to date with VTU v2 soon :D

Copy link
Member

@afontcu afontcu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, as usual! 🤗 added some thoughts here and there (as usual, too 😄 )


```js
test('vuex', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the imports here, to show that we're importing and using the real store, as the component does 👌

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was actually just writing them all in one file - I'll make this more clear.

})

expect(wrapper.html()).toContain('Count: 1')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to realise that we weren't really interacting with the store even if we're checking "Count: 1" is there – just like the example above 😅 Can we init state.count in a different value, say 25 or whatever?


```js
test('increment mutation', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be wise to add a second test case here, to show how createVuexStore is reused ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is a good idea

@lmiller1990
Copy link
Member Author

Done

@lmiller1990 lmiller1990 merged commit bb27166 into master Jul 22, 2020
@lmiller1990 lmiller1990 deleted the docs/vuex-article branch July 22, 2020 09:31
@afontcu
Copy link
Member

afontcu commented Jul 22, 2020

great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add Vuex section
2 participants