Add tests for extend function