Establish watch relay contracts and platform package wiring
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import Foundation
|
||||
import Testing
|
||||
import RemoteCore
|
||||
import WatchBridgeCommon
|
||||
import WatchBridgeWatch
|
||||
|
||||
@Test func watchPayloadPreservesCommandIdentityAndExpiry() throws {
|
||||
let issued = Date(timeIntervalSince1970: 1_700_000_000.125)
|
||||
let envelope = CommandEnvelope(
|
||||
sessionID: UUID(), televisionID: UUID(), sequence: 42,
|
||||
issuedAt: issued, expiresAt: issued.addingTimeInterval(0.5), command: .left
|
||||
)
|
||||
let container = try WatchCommandPayload.container(for: envelope)
|
||||
#expect(container.kind == .command)
|
||||
let data = container.payload
|
||||
#expect(try RelayJSON.decode(CommandEnvelope.self, from: data) == envelope)
|
||||
let object = try #require(JSONSerialization.jsonObject(with: data) as? [String: Any])
|
||||
#expect((object["expiresAt"] as? Double) == 1_700_000_000_625)
|
||||
}
|
||||
Reference in New Issue
Block a user