Full-Stack Web Development with Vue.js and Node
Introducing Vuex Chapter 8 Modifying Home.vue Let's start this section by modifying our Home.vue component. Update the script pa ...
Introducing Vuex Chapter 8 }, actions: { fetchMovies: (context, payload) => { axios({ method: 'get', url: '/movies', }) .then ...
Introducing Vuex Chapter 8 }) .then((response) => { context.commit("MOVIES", response.data.movies); }) .catch(() => { }); ...
Introducing Vuex Chapter 8 context.commit("MOVIES", response.data.movies); }) .catch(() => { }); } } }) That's it. When we na ...
Introducing Vuex Chapter 8 ], }), methods: { submit() { if (this.$refs.form.validate()) { const movie = { name: this.name, descr ...
Introducing Vuex Chapter 8 addMovie: (context, payload) => { return axios({ method: 'post', data: payload, url: '/movies', he ...
Introducing Vuex Chapter 8 Using Vuex in a small application such as this is overkill. The best use of Vuex is in large- scale a ...
9 Testing an MEVN Application Let's do a quick recap of what we have done so far in previous chapters: We created different Vue ...
Testing an MEVN Application Chapter 9 Identifies bugs beforehand: It helps to identify bugs in the early stages. Since test code ...
Testing an MEVN Application Chapter 9 Convention for writing unit tests If you follow certain guidelines and principles while wr ...
Testing an MEVN Application Chapter 9 Convention for writing end-to-end tests There are certain guidelines to be followed when w ...
Testing an MEVN Application Chapter 9 Let's also create a separate folder for test inside the test_js folder: > mkdir test To ...
Testing an MEVN Application Chapter 9 Let's go ahead and write just enough code to pass the test. Create a file called add.js in ...
Testing an MEVN Application Chapter 9 Let's rerun mocha. This should again fail, because we haven't added a method to our module ...
Testing an MEVN Application Chapter 9 }) }) }); Then, take a look at the test; it fails. Then, add the logic to our module: var ...
Testing an MEVN Application Chapter 9 Let's use chai in our previous test. In add.spec.js, add the following lines of code: var ...
Testing an MEVN Application Chapter 9 // add a new movie app.post('/movies', (req, res) => { const movie = new Movie({ name: ...
Testing an MEVN Application Chapter 9 Let's create a new file, called movies.spec.js, inside the test/units folder: var movies = ...
Testing an MEVN Application Chapter 9 Let's move on to add the functional test part. We will be writing the test for the /dummy_ ...
Testing an MEVN Application Chapter 9 Let's now run the test with the following command: $ mocha test/unit/controllers/movies.sp ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf