Skip to content

Commit de3cb2b

Browse files
committed
Add a test
1 parent f532bd3 commit de3cb2b

File tree

1 file changed

+17
-0
lines changed
  • codegen/smithy-aws-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols

1 file changed

+17
-0
lines changed

codegen/smithy-aws-kotlin-codegen/src/test/kotlin/software/amazon/smithy/kotlin/codegen/aws/protocols/RpcV2CborTest.kt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
package software.amazon.smithy.kotlin.codegen.aws.protocols
66

7+
import io.kotest.matchers.string.shouldNotContain
78
import software.amazon.smithy.kotlin.codegen.test.*
89
import kotlin.test.Test
910

@@ -145,4 +146,20 @@ class RpcV2CborTest {
145146
val serializeBody = serializer.lines(" override suspend fun serialize(context: ExecutionContext, input: PutFooStreamingRequest): HttpRequestBuilder {", "}")
146147
serializeBody.shouldContainOnlyOnceWithDiff("""builder.headers.setMissing("Content-Type", "application/vnd.amazon.eventstream")""")
147148
}
149+
150+
@Test
151+
fun testEventStreamInitialRequestDoesNotSerializeStreamMember() {
152+
val ctx = model.newTestContext("CborExample")
153+
154+
val generator = RpcV2Cbor()
155+
generator.generateProtocolClient(ctx.generationCtx)
156+
157+
ctx.generationCtx.delegator.finalize()
158+
ctx.generationCtx.delegator.flushWriters()
159+
160+
val documentSerializer = ctx.manifest.expectFileString("/src/main/kotlin/com/test/serde/PutFooStreamingRequestDocumentSerializer.kt")
161+
162+
val serializeBody = documentSerializer.lines(" serializer.serializeStruct(OBJ_DESCRIPTOR) {", "}")
163+
serializeBody.shouldNotContain("input.messages") // `messages` is the stream member and should not be serialized in the initial request
164+
}
148165
}

0 commit comments

Comments
 (0)