Full-Stack Web Development with Vue.js and Node
Testing an MEVN Application Chapter 9 There are two folders inside the test folder. One for unit testing, called unit, and anoth ...
Testing an MEVN Application Chapter 9 This controller has two methods—one GET request and a POST request. The GET request is for ...
Testing an MEVN Application Chapter 9 expect(controller).to.exist }) }) The preceding method describes the movies controller. It ...
Testing an MEVN Application Chapter 9 Since this method fetches all the existing movies from the database, we will first need to ...
Testing an MEVN Application Chapter 9 }); }); }) Let's learn step by step what we did here: We created a couple of movies with s ...
Testing an MEVN Application Chapter 9 The POST method takes the preceding four attributes of the movie and saves them to the dat ...
Testing an MEVN Application Chapter 9 }); }); describe('POST /movies', () => { it('should respond with the movie that was add ...
Testing an MEVN Application Chapter 9 Writing tests for models Let's move on to adding the tests for the models that we have def ...
Testing an MEVN Application Chapter 9 This test checks whether the Model we are describing exists or not. Let's run the test usi ...
Testing an MEVN Application Chapter 9 expect(err.errors.release_year).to.exist; done(); }) }) }) }) Here, we have prepared a mov ...
Testing an MEVN Application Chapter 9 Let's modify the component a little bit to make the tests more understandable. Replace the ...
Testing an MEVN Application Chapter 9 }, ... Now, let's run the test with the following command: $ npm run unit The test should ...
Testing an MEVN Application Chapter 9 expect(vm.years).to.eql(['2018', '2017', '2016', '2015']) }) }) This test states that the ...
Testing an MEVN Application Chapter 9 The tests should pass. Finally, to run all the tests, we can simply run the following comm ...
Testing an MEVN Application Chapter 9 test_settings: { default: { selenium_port: 4444, selenium_host: 'localhost', silent: true, ...
Testing an MEVN Application Chapter 9 // // browser.assert.elementCount(selector, count) // // For more information on custom as ...
Testing an MEVN Application Chapter 9 .end(); }, }; This is the main file, where we will add our test cases for the application. ...
Testing an MEVN Application Chapter 9 const devServerOptions = devConfig.devServer const compiler = webpack(webpackConfig) serve ...
Testing an MEVN Application Chapter 9 Let's run the package using the following command: $ npx selenium-standalone start -- -por ...
Testing an MEVN Application Chapter 9 The tests are failing because we do not have the element present with the .hello class in ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf