Jest espera que a string contenha substring

try {
    throw new Error("Username already in use. Sorry 282378292"); 
} catch (error) {
    expect(error.message).toEqual(expect.stringContaining("Username already in use"));
}
Derogatory Desert Turtoise