Add tests for key() method