5204: Fix unit test UploadMediaPresenterTest.handleImageResult (#5206)

* UploadMediaPresenterTest: fix failing unit tests

* change else if to if condition to handle all cases

* include errorCodes 68 for duplicate image and 96 for image without exif

* optimise if statements

* remove redundant cases

* modify if statements to cover all cases

* simplify all if statements

* add removed comment again

* remove unused imports
This commit is contained in:
Ritika Pahwa 2023-04-18 11:31:20 +05:30 committed by GitHub
parent 2c7f2d05cd
commit a116a17e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View file

@ -154,10 +154,9 @@ class UploadMediaPresenterTest {
uploadMediaPresenter.handleImageResult(EMPTY_CAPTION, uploadItem)
verify(view).showMessage(ArgumentMatchers.anyInt(), ArgumentMatchers.anyInt())
//Bad Picture test
//Empty Caption test
// Bad Picture Test
uploadMediaPresenter.handleImageResult(-7, uploadItem)
// TODO https://github.com/commons-app/apps-android-commons/issues/5204 verify(view)?.showBadImagePopup(ArgumentMatchers.anyInt(), ArgumentMatchers.eq(uploadItem))
verify(view)?.showBadImagePopup(ArgumentMatchers.anyInt(), ArgumentMatchers.eq(uploadItem))
}
@Test
@ -229,7 +228,7 @@ class UploadMediaPresenterTest {
*/
@Test
fun handleBadImageBaseTestFileNameExists() {
uploadMediaPresenter.handleBadImage(-4, uploadItem)
uploadMediaPresenter.handleBadImage(64, uploadItem)
verify(view).showDuplicatePicturePopup(uploadItem)
}