add onEnd test