Add tests for threads