Signal-iOS/SignalServiceKit/tests/Messages/TypingIndicatorMessageTest.swift
Evan Hahn da322d3bf9 Add "urgent" boolean to outgoing messages
To improve message reliability, we're adding an urgency flag to outgoing
messages. For example, outgoing calls are urgent, but delivery receipts
are not. [Android][] and [Desktop][] have already done this work.

At a high level, I added an `isUrgent` property to `TSOutgoingMessage`s.
It defaults to `true`. Some subclasses, like
`OWSReceiptsForSenderMessage`, override it to return `false`.

Builds off of a few other commits (not necessary to understand this
commit, but might be useful for posterity):

- e858a0d916
- 8c6d2ebe8c
- 402b117221
- 2ba0cd764d
- 266a4663e9
- 8e5009bbf7

[Android]: dc04c8ed98
[Desktop]: 06190b1434
2022-08-18 07:35:41 -05:00

38 lines
1.1 KiB
Swift

//
// Copyright (c) 2022 Open Whisper Systems. All rights reserved.
//
import XCTest
import SignalServiceKit
class TypingIndicatorMessageTest: SSKBaseTestSwift {
private func makeThread(transaction: SDSAnyWriteTransaction) -> TSThread {
TSContactThread.getOrCreateThread(
withContactAddress: SignalServiceAddress(phoneNumber: "+12223334444"),
transaction: transaction
)
}
func testIsOnline() throws {
write { transaction in
let message = TypingIndicatorMessage(
thread: makeThread(transaction: transaction),
action: .started,
transaction: transaction
)
XCTAssertTrue(message.isOnline)
}
}
func testIsUrgent() throws {
write { transaction in
let message = TypingIndicatorMessage(
thread: makeThread(transaction: transaction),
action: .started,
transaction: transaction
)
XCTAssertFalse(message.isUrgent)
}
}
}