You can and should test errors/transaction reverts.

Use waffle matcher to.be.reverted or to.be.revertedWith() to additionally test specific revert reason text.

Simple example on ERC-20 funds transfer that exceeds balance trial

Untitled

Require

An example with a require that is extended with custom user-defined message.

It is great that this very message can be tested against such that we are sure the rejection reason
is exactly what we imagined.

Require with user-defined custom reason and unit test:

Untitled

Custom function modifier

An example with require that is part of custom function modifier. The modifier is not tested itself,
but its usage is tested on a function.

Untitled