Integration testing with Mocha and Chai Flashcards

1
Q

Describe the difference between unit and integration tests.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write integration tests in Node using Mocha and Chai

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write asynchronous tests in Node using Mocha and Chai.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Test an HTTP API in Node using Mocha and Chai.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Test SQL database queries in Node using Mocha and Chai.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

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

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

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

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly