macsync/@packages/imessage/Tests/IMessageSyncTests/OutboxSendTests.swift
Natalie 576496ca3e feat(deploy): video-projects FUSE mount over DO Spaces
Generalize the photos-originals rclone-mount pattern to a video-projects
prefix so the video studio (and imajin ETL, per storage-portability-plan
§2.3) can read/write multi-GB project sources/renders as local files while
only hot data stays resident on plum (bounded VFS LRU cache). Lets a
small-disk laptop work with large footage without filling APFS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 21:10:13 -04:00

33 lines
1.4 KiB
Swift

import Foundation
import Testing
@testable import IMessageSync
@Suite("Outbox send pacing + channel normalization")
struct OutboxSendTests {
@Test("pacedDelaySeconds spans the range deterministically")
func pacedDelayBounds() {
let range: ClosedRange<Double> = 20...90
#expect(OutboxSendManager.pacedDelaySeconds(range) { 0.0 } == 20)
#expect(OutboxSendManager.pacedDelaySeconds(range) { 1.0 } == 90)
#expect(OutboxSendManager.pacedDelaySeconds(range) { 0.5 } == 55)
}
@Test("pacedDelaySeconds stays within the range for any rand in [0,1]")
func pacedDelayWithinRange() {
let range: ClosedRange<Double> = 20...90
for r in stride(from: 0.0, through: 1.0, by: 0.1) {
let d = OutboxSendManager.pacedDelaySeconds(range) { r }
#expect(d >= range.lowerBound && d <= range.upperBound)
}
}
@Test("normalizeChannel maps Messages service labels to server enum")
func channelNormalization() {
#expect(SendService.normalizeChannel("iMessage") == "imessage")
#expect(SendService.normalizeChannel("SMS") == "sms")
#expect(SendService.normalizeChannel("imessage") == "imessage")
#expect(SendService.normalizeChannel("sms") == "sms")
#expect(SendService.normalizeChannel("carrier-x") == nil)
#expect(SendService.normalizeChannel("") == nil)
}
}