Skip to content

Commit

Permalink
Update ShadowSwiftTests.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
bragelbytes committed Mar 8, 2024
1 parent 49030bb commit 4c0f273
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions Tests/ShadowSwiftTests/ShadowSwiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,43 @@ class ShadowSwiftTests: XCTestCase
wait(for: [connected], timeout: 3000)
}

func testShadowToEchoServer()
{
let message = "Hello".data
let logger = Logger(label: "ShadowToEcho")
let shadowClientConfigPath = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("ShadowClientConfig.json")

guard let shadowClientConfig = ShadowConfig.ShadowClientConfig(path: shadowClientConfigPath.path) else
{
XCTFail()
return
}

let shadowConnectionFactory = ShadowConnectionFactory(config: shadowClientConfig, logger: logger)

guard let shadowConnect = shadowConnectionFactory.connect(using: .tcp) else
{
XCTFail()
return
}

shadowConnect.send(content: message, contentContext: .defaultMessage, isComplete: true, completion: NWConnection.SendCompletion.contentProcessed(
{
(error) in

if let errorMessage = error
{
print("Error: \(errorMessage)")
XCTFail()
return
}
else
{
print("Send successful.")
}
}))
}

func testShadowSend() throws
{
let shadowQueue = DispatchQueue(label: "ShadowQueue")
Expand Down

0 comments on commit 4c0f273

Please sign in to comment.