# Testing Tools

Let us also quickly introduce the testing tools you are going to be using in our TDD approach.

You are going to learn how to use the following: Mocha, Chai, Enzyme, jsdom, Sinon.

## What is Mocha?

> Mocha is a feature-rich JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
>
> \-- [Mocha website](http://mochajs.org/)

## What is Chai?

> Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.
>
> Chai has several interfaces that allow the developer to choose the most comfortable. The chain-capable BDD styles provide an expressive language & readable style, while the TDD assert style provides a more classical feel.
>
> \-- [Chai website](http://chaijs.com/)

## What is Enzyme?

> Enzyme is a JavaScript Testing utility for React that makes it easier to assert, manipulate, and traverse your React Components' output.
>
> Enzyme's API is meant to be intuitive and flexible by mimicking jQuery's API for DOM manipulation and traversal.
>
> Enzyme is unopinionated regarding which test runner or assertion library you use, and should be compatible with all major test runners and assertion libraries out there.
>
> \-- [Enzyme docs](http://airbnb.io/enzyme/)

## What is jsdom?

> jsdom is a pure-JavaScript implementation of many web standards, notably the WHATWG DOM and HTML Standards, for use with Node.js. In general, the goal of the project is to emulate enough of a subset of a web browser to be useful for testing and scraping real-world web applications.
>
> \-- [jsdom docs](https://github.com/tmpvar/jsdom)

Perhaps an easier to understand introduction is given in:

> JSDOM is a JavaScript based headless browser that can be used to create a realistic testing environment.
>
> \-- [Enzyme docs](http://airbnb.io/enzyme/docs/guides/jsdom.html)

## What is Sinon?

> Standalone test spies, stubs and mocks for JavaScript.
>
> Works with any unit testing framework.
>
> \-- [Sinon website](http://sinonjs.org/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hackerati.gitbook.io/react-tutorial/testing_tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
