Book Image

MEAN Cookbook

By : Nicholas McClay
Book Image

MEAN Cookbook

By: Nicholas McClay

Overview of this book

The MEAN Stack is a framework for web application development using JavaScript-based technologies; MongoDB, Express, Angular, and Node.js. If you want to expand your understanding of using JavaScript to produce a fully functional standalone web application, including the web server, user interface, and database, then this book can help guide you through that transition. This book begins by configuring the frontend of the MEAN stack web application using the Angular JavaScript framework. We then implement common user interface enhancements before moving on to configuring the server layer of our MEAN stack web application using Express for our backend APIs. You will learn to configure the database layer of your MEAN stack web application using MongoDB and the Mongoose framework, including modeling relationships between documents. You will explore advanced topics such as optimizing your web application using WebPack as well as the use of automated testing with the Mocha and Chai frameworks. By the end of the book, you should have acquired a level of proficiency that allows you to confidently build a full production-ready and scalable MEAN stack application.
Table of Contents (13 chapters)

Running tests in Angular-CLI

The component, directive, pipe, service, and guard generators in Angular-CLI also create a unique test file stub as well as their class' boilerplate files. These test files are very basic, but they are all differently pre-configured to test their unique type of content.

How to do it...

Let's see what sort of test results we get from these generated boilerplate tests by running them with the test command in Angular-CLI:

ng test

How it works...

When you run the test command, Angular will run through each of these generated test files and check whether they exist and initialize properly. These simple tests don't know enough about the functionality of your application to do much else, but they are helpful as a place to start writing your own tests. They also provide a small amount of coverage that all the individual parts of your application can properly initialize on its own. You should look at these automatically generated test stubs as a ready-made space for you to add your own tests for your application.