reduce unchecked pattern matching in tests
get rid of non-total pattern matching in tests, use maybe