Skip to content

Commit

Permalink
write a test
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Dec 20, 2024
1 parent 3fae824 commit 0a399b0
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions Tests/XMTPTests/ClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -532,19 +532,18 @@ class ClientTests: XCTestCase {
print("PERF: Built a client with inboxId in \(time3)s")

// Measure time to build a client with an inboxId and apiClient
try await Client.connectToApiBackend(api: ClientOptions.Api(env: .dev, isSecure: true))
let start4 = Date()
let buildClient3 = try await Client.build(
address: fakeWallet.address,
try await Client.create(
account: fakeWallet,
options: ClientOptions(
api: ClientOptions.Api(env: .dev, isSecure: true),
dbEncryptionKey: key
),
inboxId: client.inboxID,
apiClient: client.apiClient
)
)
let end4 = Date()
let time4 = end4.timeIntervalSince(start4)
print("PERF: Built a client with inboxId and apiClient in \(time4)s")
print("PERF: Create a client with prebuild in \(time4)s")

// Assert performance comparisons
XCTAssertTrue(
Expand All @@ -560,15 +559,7 @@ class ClientTests: XCTestCase {
)
XCTAssertTrue(
time4 < time1,
"Building a client with apiClient should be faster than creating one."
)
XCTAssertTrue(
time4 < time2,
"Building a client with apiClient should be faster than building one."
)
XCTAssertTrue(
time4 < time2,
"Building a client with apiClient should be faster than building one with inboxId."
"Creating a client with apiClient should be faster than creating one without."
)

// Assert that inbox IDs match
Expand All @@ -580,10 +571,6 @@ class ClientTests: XCTestCase {
client.inboxID, buildClient2.inboxID,
"Inbox ID of the created client and second built client should match."
)
XCTAssertEqual(
client.inboxID, buildClient3.inboxID,
"Inbox ID of the created client and second built client should match."
)
}

}

0 comments on commit 0a399b0

Please sign in to comment.