fix: support archived thread search on android homepage
This commit is contained in:
@@ -49,6 +49,27 @@ public class MainActivityConversationSearchTest {
|
||||
assertEquals("p2", filteredByFolder.optJSONObject(0).optString("projectId", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filterConversationItemsMatchesFolderArchiveSearchAliases() throws Exception {
|
||||
JSONArray source = new JSONArray()
|
||||
.put(new JSONObject()
|
||||
.put("projectId", "folder-boss")
|
||||
.put("conversationType", "folder_archive")
|
||||
.put("folderKey", "mac-studio:boss")
|
||||
.put("projectTitle", "Boss")
|
||||
.put("threadTitle", "Boss")
|
||||
.put("folderLabel", "2 个线程 · 最近:发布回滚")
|
||||
.put("searchAliases", new JSONArray().put("发布回滚").put("Android UI 收尾"))
|
||||
.put("lastMessagePreview", "最近:发布回滚")
|
||||
.put("latestReplyLabel", "11:00"));
|
||||
|
||||
JSONArray filtered = MainActivity.filterConversationItems(source, "发布回滚");
|
||||
|
||||
assertEquals(1, filtered.length());
|
||||
assertEquals("folder-boss", filtered.optJSONObject(0).optString("projectId", ""));
|
||||
assertEquals("发布回滚", filtered.optJSONObject(0).optString("searchMatchLabel", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void conversationsHeader_usesSearchIconAndPlusButton() throws Exception {
|
||||
MainActivity activity = Robolectric.buildActivity(MainActivity.class).setup().get();
|
||||
@@ -103,15 +124,15 @@ public class MainActivityConversationSearchTest {
|
||||
MainActivity activity = Robolectric.buildActivity(MainActivity.class).setup().get();
|
||||
ReflectionHelpers.setField(activity, "conversationsData", new JSONArray()
|
||||
.put(new JSONObject()
|
||||
.put("projectId", "boss-thread-1")
|
||||
.put("conversationType", "single_device")
|
||||
.put("projectId", "folder-boss")
|
||||
.put("conversationType", "folder_archive")
|
||||
.put("folderKey", "mac-studio:boss")
|
||||
.put("folderLabel", "Boss")
|
||||
.put("projectTitle", "Boss")
|
||||
.put("threadTitle", "发布回滚")
|
||||
.put("threadTitle", "Boss")
|
||||
.put("lastMessagePreview", "最近:发布回滚")
|
||||
.put("latestReplyLabel", "11:00")
|
||||
.put("threadCount", 2)));
|
||||
.put("searchAliases", new JSONArray().put("发布回滚").put("Android UI 收尾"))));
|
||||
|
||||
ReflectionHelpers.callInstanceMethod(activity, "showContent");
|
||||
Shadows.shadowOf(activity.getMainLooper()).idle();
|
||||
|
||||
Reference in New Issue
Block a user