@@ -324,14 +324,13 @@ class LocalSerializerTest : public ::testing::Test {
324
324
325
325
void ExpectSerializationRoundTrip (const NamedQuery& named_query,
326
326
const ::firestore::NamedQuery& proto) {
327
- ByteString bytes = EncodeNamedQuery (&serializer, named_query);
327
+ ByteString bytes = EncodeNamedQuery (named_query);
328
328
auto actual = ProtobufParse<::firestore::NamedQuery>(bytes);
329
329
EXPECT_TRUE (msg_diff.Compare (proto, actual)) << message_differences;
330
330
}
331
331
332
- ByteString EncodeNamedQuery (local::LocalSerializer* serializer,
333
- const NamedQuery& named_query) {
334
- return MakeByteString (serializer->EncodeNamedQuery (named_query));
332
+ ByteString EncodeNamedQuery (const NamedQuery& named_query) {
333
+ return MakeByteString (serializer.EncodeNamedQuery (named_query));
335
334
}
336
335
337
336
void ExpectDeserializationRoundTrip (const NamedQuery& named_query,
@@ -370,120 +369,6 @@ class LocalSerializerTest : public ::testing::Test {
370
369
MessageDifferencer msg_diff;
371
370
};
372
371
373
- // TODO(b/174608374): Remove these tests once we perform a schema migration.
374
- TEST_F (LocalSerializerTest, SetMutationAndTransformMutationAreSquashed) {
375
- ::firestore::client::WriteBatch batch_proto{};
376
- batch_proto.set_batch_id (42 );
377
- *batch_proto.add_writes () = SetProto ();
378
- *batch_proto.add_writes () = LegacyTransformProto ();
379
- *batch_proto.mutable_local_write_time () = WriteTimeProto ();
380
-
381
- ByteString bytes = ProtobufSerialize (batch_proto);
382
- StringReader reader (bytes);
383
- auto message = Message<firestore_client_WriteBatch>::TryParse (&reader);
384
- MutationBatch decoded = serializer.DecodeMutationBatch (&reader, *message);
385
- ASSERT_EQ (1 , decoded.mutations ().size ());
386
- ASSERT_EQ (Mutation::Type::Set, decoded.mutations ()[0 ].type ());
387
-
388
- Message<google_firestore_v1_Write> encoded{
389
- remote_serializer.EncodeMutation (decoded.mutations ()[0 ])};
390
- ExpectSet (*encoded);
391
- ExpectUpdateTransform (*encoded);
392
- }
393
-
394
- // TODO(b/174608374): Remove these tests once we perform a schema migration.
395
- TEST_F (LocalSerializerTest, PatchMutationAndTransformMutationAreSquashed) {
396
- ::firestore::client::WriteBatch batch_proto{};
397
- batch_proto.set_batch_id (42 );
398
- *batch_proto.add_writes () = PatchProto ();
399
- *batch_proto.add_writes () = LegacyTransformProto ();
400
- *batch_proto.mutable_local_write_time () = WriteTimeProto ();
401
-
402
- ByteString bytes = ProtobufSerialize (batch_proto);
403
- StringReader reader (bytes);
404
- auto message = Message<firestore_client_WriteBatch>::TryParse (&reader);
405
- MutationBatch decoded = serializer.DecodeMutationBatch (&reader, *message);
406
- ASSERT_EQ (1 , decoded.mutations ().size ());
407
- ASSERT_EQ (Mutation::Type::Patch, decoded.mutations ()[0 ].type ());
408
-
409
- Message<google_firestore_v1_Write> encoded{
410
- remote_serializer.EncodeMutation (decoded.mutations ()[0 ])};
411
- ExpectPatch (*encoded);
412
- ExpectUpdateTransform (*encoded);
413
- }
414
-
415
- // TODO(b/174608374): Remove these tests once we perform a schema migration.
416
- TEST_F (LocalSerializerTest, TransformAndTransformThrowError) {
417
- ::firestore::client::WriteBatch batch_proto{};
418
- batch_proto.set_batch_id (42 );
419
- *batch_proto.add_writes () = LegacyTransformProto ();
420
- *batch_proto.add_writes () = LegacyTransformProto ();
421
- *batch_proto.mutable_local_write_time () = WriteTimeProto ();
422
-
423
- ByteString bytes = ProtobufSerialize (batch_proto);
424
- StringReader reader (bytes);
425
- auto message = Message<firestore_client_WriteBatch>::TryParse (&reader);
426
- EXPECT_ANY_THROW (serializer.DecodeMutationBatch (&reader, *message));
427
- }
428
-
429
- // TODO(b/174608374): Remove these tests once we perform a schema migration.
430
- TEST_F (LocalSerializerTest, DeleteAndTransformThrowError) {
431
- ::firestore::client::WriteBatch batch_proto{};
432
- batch_proto.set_batch_id (42 );
433
- *batch_proto.add_writes () = DeleteProto ();
434
- *batch_proto.add_writes () = LegacyTransformProto ();
435
- *batch_proto.mutable_local_write_time () = WriteTimeProto ();
436
-
437
- ByteString bytes = ProtobufSerialize (batch_proto);
438
- StringReader reader (bytes);
439
- auto message = Message<firestore_client_WriteBatch>::TryParse (&reader);
440
- EXPECT_ANY_THROW (serializer.DecodeMutationBatch (&reader, *message));
441
- }
442
-
443
- // TODO(b/174608374): Remove these tests once we perform a schema migration.
444
- TEST_F (LocalSerializerTest, MultipleMutationsAreSquashed) {
445
- ::firestore::client::WriteBatch batch_proto{};
446
- batch_proto.set_batch_id (42 );
447
- *batch_proto.add_writes () = SetProto ();
448
- *batch_proto.add_writes () = SetProto ();
449
- *batch_proto.add_writes () = LegacyTransformProto ();
450
- *batch_proto.add_writes () = DeleteProto ();
451
- *batch_proto.add_writes () = PatchProto ();
452
- *batch_proto.add_writes () = LegacyTransformProto ();
453
- *batch_proto.add_writes () = PatchProto ();
454
- *batch_proto.mutable_local_write_time () = WriteTimeProto ();
455
-
456
- ByteString bytes = ProtobufSerialize (batch_proto);
457
- StringReader reader (bytes);
458
- auto message = Message<firestore_client_WriteBatch>::TryParse (&reader);
459
- MutationBatch decoded = serializer.DecodeMutationBatch (&reader, *message);
460
- ASSERT_EQ (5 , decoded.mutations ().size ());
461
-
462
- Message<google_firestore_v1_Write> encoded{
463
- remote_serializer.EncodeMutation (decoded.mutations ()[0 ])};
464
- ExpectSet (*encoded);
465
- ExpectNoUpdateTransform (*encoded);
466
-
467
- encoded =
468
- MakeMessage (remote_serializer.EncodeMutation (decoded.mutations ()[1 ]));
469
- ExpectSet (*encoded);
470
- ExpectUpdateTransform (*encoded);
471
-
472
- encoded =
473
- MakeMessage (remote_serializer.EncodeMutation (decoded.mutations ()[2 ]));
474
- ExpectDelete (*encoded);
475
-
476
- encoded =
477
- MakeMessage (remote_serializer.EncodeMutation (decoded.mutations ()[3 ]));
478
- ExpectPatch (*encoded);
479
- ExpectUpdateTransform (*encoded);
480
-
481
- encoded =
482
- MakeMessage (remote_serializer.EncodeMutation (decoded.mutations ()[4 ]));
483
- ExpectPatch (*encoded);
484
- ExpectNoUpdateTransform (*encoded);
485
- }
486
-
487
372
TEST_F (LocalSerializerTest, EncodesMutationBatch) {
488
373
Mutation base =
489
374
PatchMutation (Key (" docs/1" ), WrapObject (" a" , " b" ), FieldMask{Field (" a" )},
0 commit comments