mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-24 23:45:18 +00:00
* SwiftTesting: NoiseProtocolTests + BinaryProtocolPaddingTests * SwiftTesting: `NotificationStreamAssemblerTests` * SwiftTesting: `NostrProtocolTests` * SwiftTesting: `BinaryProtocolTests` * SwiftTesting: `PeerIDTests` * SwiftTesting: `BLEServiceTests` * SwiftTesting: `CommandProcessorTests` * SwiftTesting: `GCSFilterTests` * SwiftTesting: `GeohashBookmarksStoreTests` * Remove `peerID` test constants * Remove PeerID + String interop from tests * Refactor IntegrationTests to extract state management * Refactor global state management of MockBLEService * NoiseProtocolSwiftTests: `actor` -> `struct` * Remove measurement tests w/ no benchmark * `NoiseProtocolSwiftTests` -> `NoiseProtocolTests` * SwiftTesting: `LocationChannelsTests` * SwiftTesting: `GossipSyncManagerTests` * SwiftTesting: `LocationNotesManagerTests` * Global `sleep` function for tests * SwiftTesting: `IntegrationTests` --------- Co-authored-by: jack <jackjackbits@users.noreply.github.com>
43 lines
1.4 KiB
Swift
43 lines
1.4 KiB
Swift
import Testing
|
|
@testable import bitchat
|
|
|
|
struct CommandProcessorTests {
|
|
private var identityManager = MockIdentityManager(MockKeychain())
|
|
|
|
@MainActor
|
|
@Test func slapNotFoundGrammar() {
|
|
let processor = CommandProcessor(chatViewModel: nil, meshService: nil, identityManager: identityManager)
|
|
let result = processor.process("/slap @system")
|
|
switch result {
|
|
case .error(let message):
|
|
#expect(message == "cannot slap system: not found")
|
|
default:
|
|
Issue.record("Expected error result")
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
@Test func hugNotFoundGrammar() {
|
|
let processor = CommandProcessor(chatViewModel: nil, meshService: nil, identityManager: identityManager)
|
|
let result = processor.process("/hug @system")
|
|
switch result {
|
|
case .error(let message):
|
|
#expect(message == "cannot hug system: not found")
|
|
default:
|
|
Issue.record("Expected error result")
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
@Test func slapUsageMessage() {
|
|
let processor = CommandProcessor(chatViewModel: nil, meshService: nil, identityManager: identityManager)
|
|
let result = processor.process("/slap")
|
|
switch result {
|
|
case .error(let message):
|
|
#expect(message == "usage: /slap <nickname>")
|
|
default:
|
|
Issue.record("Expected error result for usage message")
|
|
}
|
|
}
|
|
}
|