add key judgement in hook
add hook function unittest