Integration testing with Mocha and Chai Flashcards
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.
Write integration tests in Node using Mocha and Chai
https://www.codementor.io/olatundegaruba/integration-testing-supertest-mocha-chai-6zbh6sefz
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.
Test an HTTP API in Node using Mocha and Chai.
.
Test SQL database queries in Node using Mocha and Chai.
.
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
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