Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Web Development with MongoDB and Node.js

You're reading from   Web Development with MongoDB and Node.js Build an interactive and full-featured web application from scratch using Node.js and MongoDB

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher Packt
ISBN-13 9781783987306
Length 294 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jason Krol Jason Krol
Author Profile Icon Jason Krol
Jason Krol
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Web Development with MongoDB and Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Welcome to JavaScript in the Full Stack FREE CHAPTER 2. Getting Up and Running 3. Node and MongoDB Basics 4. Writing an Express.js Server 5. Dynamic HTML with Handlebars 6. Controllers and View Models 7. Persisting Data with MongoDB 8. Creating a RESTful API 9. Testing Your Code 10. Deploying with Cloud-based Services 11. Single Page Applications with Popular Frontend Frameworks 12. Popular Node.js Web Frameworks Index

Tools of the trade


Let's start by taking a look at the various tools and libraries we're going to be using to run and write our tests. There are three main concepts we need to cover before we can actually start writing real tests. The first is a test runner, or the framework we use to run our suite of tests. The second is the assertion library itself, the language we use to write our tests. Finally, we'll take a look at the idea of spies and stubs, which are fake representatives of certain parts of our code that are relied on when we need to track function calls to ensure an expected behavior.

Running tests with the Mocha framework

When writing tests for an application, you typically write them in batches that are module specific. These batches are referred to as suites or specs. Each suite typically contains a batch of tests organized in a way that almost mirrors the application itself. With Node, the idea is no different in that each suite of tests we write will be specific to an individual...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images