Fixes #4942 Change category extraction algorithm (#4943)

* updated addCategory()method

* update addCategory()method

* add unit test for none category

* add comments to addCategory()method

* update comments

* update comments for addCategory()method
This commit is contained in:
HCH 2022-04-28 22:21:45 +08:00 committed by GitHub
parent 79086fe942
commit b2a901b9b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 7 deletions

View file

@ -80,4 +80,32 @@ class CategoryEditHelperUnitTests {
ArgumentMatchers.anyString()
)
}
@Test
@Throws(Exception::class)
fun testMakeUnCategoryEdit() {
helper.makeCategoryEdit(context, media, listOf("Test"), "== {{int:filedesc}} ==\n" +
"{{Information\n" +
"|description=\n" +
"\n" +
"|source={{own}}\n" +
"|author=[[User:UserForthBeta|UserForthBeta]]\n" +
"|date={{According to Exif data|2022-03-06}}\n" +
"}}\n" +
"{{Location|22.538830555555556|114.08847222222222}}\n" +
"== {{int:license-header}} ==\n" +
"{{self|cc-zero}}\n" +
"\n" +
"{{Uploaded from Mobile|platform=Android|version=3.1.1-debug-master~e7a9ba9ad}}\n" +
"{{Uncategorized|year=2022|month=April|day=23}}")
Mockito.verify(viewUtilWrapper, Mockito.times(1)).showShortToast(
context,
context.getString(R.string.category_edit_helper_make_edit_toast)
)
Mockito.verify(pageEditClient, Mockito.times(1)).edit(
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString(),
ArgumentMatchers.anyString()
)
}
}