added spy for unit tests