Extend and refactor tests