function spy completed