fixed address for map
This commit is contained in:
@@ -284,6 +284,23 @@ class AdminPostServiceTest {
|
||||
assertThat(post.getCity()).isEqualTo("Тверь");
|
||||
}
|
||||
|
||||
@Test
|
||||
void updatePost_keepsClientAddressAndTakesCityFromGeocoder() {
|
||||
Post post = post(1L, PostStatus.ACTIVE);
|
||||
when(postRepository.findById(1L)).thenReturn(java.util.Optional.of(post));
|
||||
when(postRepository.save(any(Post.class))).thenAnswer(inv -> inv.getArgument(0));
|
||||
when(geocodingService.getAddress("55.0", "37.0"))
|
||||
.thenReturn(new com.krylov.refound.dto.AddressInfo("Москва", "Тверской район"));
|
||||
|
||||
AdminPostResponse dto = service.updatePost(1L, "LOSS", "Кот", " Москва, Тверская улица, 7 ",
|
||||
55.0, 37.0, null, null, null, false, null, List.of(), "[]");
|
||||
|
||||
assertThat(post.getAddress()).isEqualTo("Москва, Тверская улица, 7");
|
||||
assertThat(post.getCity()).isEqualTo("Москва");
|
||||
assertThat(post.getDistrict()).isEqualTo("Тверской район");
|
||||
assertThat(dto.getAddress()).isEqualTo("Москва, Тверская улица, 7");
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateStatus_closesPostAndIncrementsStatistics() {
|
||||
Post post = post(1L, PostStatus.ACTIVE);
|
||||
|
||||
Reference in New Issue
Block a user