relay: initial rewrite of unit tests