Skip to Content
Building Blockchain Projects
book

Building Blockchain Projects

by Narayan Prusty
April 2017
Intermediate to advanced
266 pages
7h 4m
English
Packt Publishing
Content preview from Building Blockchain Projects

Writing tests in JavaScript

Truffle's JavaScript testing framework is built on top of mocha. Mocha is a JavaScript framework to write tests, whereas chai is an assertion library.

Testing frameworks are used to organize and execute tests, whereas assertion libraries provide utilities to verify that things are correct. Assertion libraries make it a lot easier to test your code so you don't have to perform thousands of if statements. Most of the testing frameworks don't have an assertion library included and let the user plug which one they want to use.

Before continuing further, you need to learn how to write tests with mocha and chai. To learn mocha, visit https://mochajs.org/ and to learn chai, visit http://chaijs.com/.

Your tests should ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Blockchain Apps

Building Blockchain Apps

Michael Juntao Yuan
Blockchain Development with Hyperledger

Blockchain Development with Hyperledger

Salman A. Baset, Luc Desrosiers, Nitin Gaur, Petr Novotny
Advanced Blockchain Development

Advanced Blockchain Development

Imran Bashir, Narayan Prusty

Publisher Resources

ISBN: 9781787122147Supplemental Content