From 1967934ae85789b62885e2850de6e008840eb97b Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Thu, 1 Feb 2024 09:03:47 -0800 Subject: [PATCH] potential test --- Tests/XMTPTests/CodecTests.swift | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Tests/XMTPTests/CodecTests.swift b/Tests/XMTPTests/CodecTests.swift index bb1eff11..08ce1300 100644 --- a/Tests/XMTPTests/CodecTests.swift +++ b/Tests/XMTPTests/CodecTests.swift @@ -78,6 +78,33 @@ class CodecTests: XCTestCase { XCTAssertEqual(nil, content) XCTAssertEqual("pi", messages[0].fallbackContent) } + + func testCanGetPushInfoBeforeDecoded() async throws { + let fixtures = await fixtures() + + let aliceClient = fixtures.aliceClient! + let aliceConversation = try await aliceClient.conversations.newConversation(with: fixtures.bob.address) + + aliceClient.register(codec: NumberCodec()) + + try await aliceConversation.send(content: 3.14, options: .init(contentType: NumberCodec().contentType)) + + let messages = try await aliceConversation.messages() + XCTAssertEqual(messages.count, 1) + + let message = try await MessageV2.encode( + client: aliceClient, + content: messages[0].encodedContent, + topic: aliceConversation.topic, + keyMaterial: Data(aliceConversation.keyMaterial!), + codec: NumberCodec() + ) + + XCTAssertEqual(false, message.shouldPush) + XCTAssert(!message.senderHmac.isEmpty) + + } + func testCompositeCodecOnePart() async throws { let fixtures = await fixtures()