-
Notifications
You must be signed in to change notification settings - Fork 35
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
where is your blog? #1
Comments
Hi, thanks for checking out the repo. There is no blog, I'm writing everything into the README file. I don't have much time to do that, but I have already managed to cover some decisions. I would like to focus mainly on testing techniques because those are not very well covered in any official documentation. If there is anything in particular not clear to you, then let me know. Any feedback is welcome. |
|
Your understanding is right. 🥇 I have expanded the section with I have also added few examples of DI in action: https://github.com/mcibique/vue-testing-examples#why-dependency-injection, to show that DI is not only about maintaining large dependency trees and mocking in unit tests, but it can help in other situations too. |
i find Testing Vuex in components(Official documentation), in this example, they mock store in Smart components that's not accordance with yours your table, i get confused and you said We should mock out only a necessary minimum from the component, emmm.. |
Q1: I started with the exact same tutorial as you mentioned, but this just doesn't work with any project I have been working on. The idea is nice, the solution looks good, but it doesn't scale very well for larger applications. It adds lots of additional code for each component tests and in many cases, the mock does exactly the same thing as logic in the store. A better solution is to reuse existing store as it is. I have added a new section (https://github.com/mcibique/vue-testing-examples#mocking-store-vuex) to cover this topic little more and how to reuse the store. Q2: I think I'm going to rephrase it. It should be saying "You should mock as less as it gets". If you keep original application logic intact during all your tests, then more confidence you get about your component working properly. Let's say you have a smart component which uses a store, router, 3rd party UI library (material or bootstrap), REST API, native browser APIs (canvas, localStorage) and also communicates with workers. If you decide to use only unit tests, all these parts must go away and be mocked. If you decide to go with integration tests because they suit better for smart components, then these parts should stay. It's not always possible, e.g. API calls cannot be executed because there's no server available. Native browser APIs can be problematic. If you run your tests with Karma and Chrome/Firefox, you have canvas available. But if you run your tests with mocha and jsdom, you don't have canvas, you have to mock it. Same can happen with workers and localStorage. You might have a service which needs to communicate with a browser extension, that's also not possible. On the other hand, store, router and 3rd party libraries usually don't require any special APIs thus they can stay without mocking. There is one amazing library for testing React which you can check out: https://github.com/kentcdodds/react-testing-library, written by Kent C Dodds who does workshops on testing, talks on egghead.io about components. The library was introduced just recently, has also couple links to guidelines and what I like they also realize that integration tests are a thing, they don't even have shallow rendering. |
i think it make some sense,we trust 3rd-UI and Vue. |
Hi, i'm learning how to test a vue project recently so i star this. since i'm a rookie in js and i'm looking forward to your explain about this project such as what you use in this project and why use them and how to use them.i want to what's principle in it and how to design them. so i write this because you don't show you email.
if you don't mind,
I want look at your blog and learn :) .
else
i'm going to read your commits one by one :(
thank you very very very ... much!
The text was updated successfully, but these errors were encountered: