Checking Strings
Learn various approaches for checking string results in a test in this lesson.
We'll cover the following...
Performing a strict match
The project for this lesson will be familiar from previous lessons. The difference will be that getPerson
and getCompany
return string messages when the person or company can’t be found. The tests in the project are required to check that the correct messages are returned.
A copy of the starter code is in the code widget below:
import { getCompany } from "./data"; test("Should return not found message when company not found", async () => { const company = await getCompany(-99); });
Starter code
We are very familiar with the toBe
matcher now. As an ...
Access this course and 1400+ top-rated courses and projects.