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