Unit Test
noun
say it: “YOO-nit test” /ˈjuːnɪt tɛst/
A small piece of code that runs one function with chosen inputs and checks that the answer is what you expected.
What is Unit Test in JavaScript?
Unit Test — A small automated check of one focused unit of behavior.
test("totals an order", () => {
expect(total(3, 4)).toBe(12);
});
In a sentence
- “I wrote a unit test that checks addTip(20) gives back 23, so I'll know right away if I break it.”
- “I ran node --test, and every unit test for the ticket booth passed.”
- “A unit test caught that formatTime(60) returned "0:60" instead of "1:00".”
- “I wrote a unit test that checks two lattes and a muffin total $13.50.”
- “The unit test failed, which showed me the discount was taken off twice.”
Level: Freelancer · More JavaScript terms at this level
Updated