mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
@@ -46,6 +46,7 @@ abstract class ControllerTest {
|
||||
protected val message: Message = getMessage(group.id)
|
||||
protected val text: String = getRandomString(5)
|
||||
protected val timestamp = 42L
|
||||
protected val unreadCount = 42
|
||||
|
||||
protected fun assertJsonEquals(json: String, obj: Any) {
|
||||
assertEquals(json, outputCtx.json(obj).resultString(), STRICT)
|
||||
|
||||
@@ -58,7 +58,8 @@ internal class ContactControllerTest : ControllerTest() {
|
||||
every { contactManager.contacts } returns listOf(contact)
|
||||
every { conversationManager.getGroupCount(contact.id).latestMsgTime } returns timestamp
|
||||
every { connectionRegistry.isConnected(contact.id) } returns connected
|
||||
every { ctx.json(listOf(contact.output(timestamp, connected))) } returns ctx
|
||||
every { conversationManager.getGroupCount(contact.id).unreadCount } returns unreadCount
|
||||
every { ctx.json(listOf(contact.output(timestamp, connected, unreadCount))) } returns ctx
|
||||
controller.list(ctx)
|
||||
}
|
||||
|
||||
@@ -313,10 +314,11 @@ internal class ContactControllerTest : ControllerTest() {
|
||||
"handshakePublicKey": ${toJson(contact.handshakePublicKey!!.encoded)},
|
||||
"verified": ${contact.isVerified},
|
||||
"lastChatActivity": $timestamp,
|
||||
"connected": $connected
|
||||
"connected": $connected,
|
||||
"unreadCount": $unreadCount
|
||||
}
|
||||
"""
|
||||
assertJsonEquals(json, contact.output(timestamp, connected))
|
||||
assertJsonEquals(json, contact.output(timestamp, connected, unreadCount))
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user