Add hook tests

Now it is easy to write tests for hooks!