Unit Tests Flashcards

1
Q

What are unit tests?

A

A unit test is a way of testing a unit - the smallest piece of code that can be logically isolated in a system. In most programming languages, that is a function, a subroutine, a method or property.

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

Why is it important to write unit tests?

A

Good way to debug code and can help test when refactoring code.

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

What code should be tested with a unit test? What code is not well suited for unit tests?

A

A single unit.
Large blocks of code (e.g. multiple components talking to each other)

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

What is Jest? What are some other popular JavaScript unit testing frameworks?

A

Jest is a JavaScript testing framework built on top of Jasmine and maintained by Meta.
Other popular JavaScript unit testing frameworks include Mocha, Cypress, Selenium, QUnit, and Cucumber.

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