@@ -68,6 +68,7 @@ import io.kotest.property.arbitrary.alphanumeric
6868import io.kotest.property.arbitrary.egyptianHieroglyphs
6969import io.kotest.property.arbitrary.enum
7070import io.kotest.property.arbitrary.int
71+ import io.kotest.property.arbitrary.map
7172import io.kotest.property.arbitrary.merge
7273import io.kotest.property.arbitrary.next
7374import io.kotest.property.arbitrary.string
@@ -104,7 +105,7 @@ class DataConnectGrpcClientUnitTest {
104105 private val connectorConfig = Arb .dataConnect.connectorConfig().next(rs)
105106 private val requestId = Arb .dataConnect.requestId().next(rs)
106107 private val operationName = Arb .dataConnect.operationName().next(rs)
107- private val variables = Arb .proto.struct().next(rs)
108+ private val variables = Arb .proto.struct().next(rs).struct
108109 private val callerSdkType = Arb .enum<FirebaseDataConnect .CallerSdkType >().next(rs)
109110
110111 private val mockDataConnectAuth: DataConnectAuth =
@@ -193,7 +194,7 @@ class DataConnectGrpcClientUnitTest {
193194
194195 @Test
195196 fun `executeQuery() should return data and errors` () = runTest {
196- val responseData = Arb .proto.struct().next(rs)
197+ val responseData = Arb .proto.struct().next(rs).struct
197198 val responseErrors = List (3 ) { GraphqlErrorInfo .random(RandomSource .default()) }
198199 coEvery { mockDataConnectGrpcRPCs.executeQuery(any(), any(), any()) } returns
199200 ExecuteQueryResponse .newBuilder()
@@ -210,7 +211,7 @@ class DataConnectGrpcClientUnitTest {
210211
211212 @Test
212213 fun `executeMutation() should return data and errors` () = runTest {
213- val responseData = Arb .proto.struct().next(rs)
214+ val responseData = Arb .proto.struct().next(rs).struct
214215 val responseErrors = List (3 ) { GraphqlErrorInfo .random(RandomSource .default()) }
215216 coEvery { mockDataConnectGrpcRPCs.executeMutation(any(), any(), any()) } returns
216217 ExecuteMutationResponse .newBuilder()
@@ -253,7 +254,7 @@ class DataConnectGrpcClientUnitTest {
253254
254255 @Test
255256 fun `executeQuery() should retry with a fresh auth token on UNAUTHENTICATED` () = runTest {
256- val responseData = Arb .proto.struct().next(rs)
257+ val responseData = Arb .proto.struct().next(rs).struct
257258 val forceRefresh = AtomicBoolean (false )
258259 coEvery { mockDataConnectAuth.forceRefresh() } answers { forceRefresh.set(true ) }
259260 coEvery { mockDataConnectGrpcRPCs.executeQuery(any(), any(), any()) } answers
@@ -284,7 +285,7 @@ class DataConnectGrpcClientUnitTest {
284285
285286 @Test
286287 fun `executeMutation() should retry with a fresh auth token on UNAUTHENTICATED` () = runTest {
287- val responseData = Arb .proto.struct().next(rs)
288+ val responseData = Arb .proto.struct().next(rs).struct
288289 val forceRefresh = AtomicBoolean (false )
289290 coEvery { mockDataConnectAuth.forceRefresh() } answers { forceRefresh.set(true ) }
290291 coEvery { mockDataConnectGrpcRPCs.executeMutation(any(), any(), any()) } answers
@@ -315,7 +316,7 @@ class DataConnectGrpcClientUnitTest {
315316
316317 @Test
317318 fun `executeQuery() should retry with a fresh AppCheck token on UNAUTHENTICATED` () = runTest {
318- val responseData = Arb .proto.struct().next(rs)
319+ val responseData = Arb .proto.struct().next(rs).struct
319320 val forceRefresh = AtomicBoolean (false )
320321 coEvery { mockDataConnectAppCheck.forceRefresh() } answers { forceRefresh.set(true ) }
321322 coEvery { mockDataConnectGrpcRPCs.executeQuery(any(), any(), any()) } answers
@@ -346,7 +347,7 @@ class DataConnectGrpcClientUnitTest {
346347
347348 @Test
348349 fun `executeMutation() should retry with a fresh AppCheck token on UNAUTHENTICATED` () = runTest {
349- val responseData = Arb .proto.struct().next(rs)
350+ val responseData = Arb .proto.struct().next(rs).struct
350351 val forceRefresh = AtomicBoolean (false )
351352 coEvery { mockDataConnectAppCheck.forceRefresh() } answers { forceRefresh.set(true ) }
352353 coEvery { mockDataConnectGrpcRPCs.executeMutation(any(), any(), any()) } answers
@@ -593,9 +594,9 @@ class DataConnectGrpcClientOperationResultUnitTest {
593594 fun `deserialize() with non-null data should treat DataConnectUntypedData specially` () = runTest {
594595 checkAll(propTestConfig, Arb .proto.struct(), Arb .dataConnect.operationErrors()) { data, errors
595596 ->
596- val operationResult = OperationResult (data, errors)
597+ val operationResult = OperationResult (data.struct , errors)
597598 val result = operationResult.deserialize(DataConnectUntypedData , serializersModule = null )
598- result.shouldHaveDataAndErrors(data, errors)
599+ result.shouldHaveDataAndErrors(data.struct , errors)
599600 }
600601 }
601602
@@ -635,7 +636,7 @@ class DataConnectGrpcClientOperationResultUnitTest {
635636 runTest {
636637 checkAll(
637638 propTestConfig,
638- Arb .proto.struct(),
639+ Arb .proto.struct().map { it.struct } ,
639640 Arb .dataConnect.operationErrors(range = 1 .. 10 )
640641 ) { dataStruct, errors ->
641642 val operationResult = OperationResult (dataStruct, errors)
@@ -697,7 +698,7 @@ class DataConnectGrpcClientOperationResultUnitTest {
697698
698699 @Test
699700 fun `deserialize() should throw if decoding fails and error list is empty` () = runTest {
700- checkAll(propTestConfig, Arb .proto.struct()) { dataStruct ->
701+ checkAll(propTestConfig, Arb .proto.struct().map { it.struct } ) { dataStruct ->
701702 assume(! dataStruct.containsFields(" foo" ))
702703 val operationResult = OperationResult (dataStruct, emptyList())
703704 val exception: DataConnectOperationException =
0 commit comments