Integration testing with Mocha and Chai Flashcards Preview

Phase_2 > Integration testing with Mocha and Chai > Flashcards

Flashcards in Integration testing with Mocha and Chai Deck (7)
Loading flashcards...
1

Describe the difference between unit and integration tests.

A unit test validates whether a unit of code performs and executes in the way it was intended.

An integration test validates if a group of units ( or modules or components ) work together as they were intended.

2

Write integration tests in Node using Mocha and Chai

https://www.codementor.io/olatundegaruba/integration-testing-supertest-mocha-chai-6zbh6sefz

3

Write asynchronous tests in Node using Mocha and Chai.

Asynchronous tests are easy to write using Mocha. Checking out the mochajs.org site we cover this. Within mocha you have the describe( ) method. The describe method takes two arguments and uses this as its testing base. The describe( ) method takes the name of the function being tested and the function that does the testing.

4

Test an HTTP API in Node using Mocha and Chai.

.

5

Test SQL database queries in Node using Mocha and Chai.

.

6

Describe what Mocha's done function is for in Node. Also explain what the it( ) does.

The done( ) function can be used in the stead of a Promise function.

The it( ) function is used in mocha async tests to further describe what the function being tested is doing. The it( ) takes two arguments the description of what it does and the function that checks to see if it performs as described.

On the mochajs.org landing page we're introduced to how easy asynchronous coding is, we're also introduced to a function frequently used in async coding the done callback function (function taken as an arg and called inside the function) to the it( ) method. The done function

7

Describe the difference between Chai's eql and equal in Node.

equal = strictly equal, this means that we're checking to see if both objects are copies of one another.

eql = deeply equal, this means that we're checking to see if the properties of two objects have the same value as well as deep linked object values.

https://stackoverflow.com/questions/36798993/what-is-the-difference-between-equal-and-eql-in-chai-library