Unit test for checkout (PR- 2015) and payment (PR2021) - #2054
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces several unit tests to verify session updates, serialization and deserialization of new checkout model fields (including AffirmDetails, DonationCampaignsRequest, DonationPaymentMethod, and Gopay Wallet), and transaction link ID serialization. The feedback suggests making the JSON serialization assertion in TestTransactionLinkId more robust by checking for substring containment rather than exact string equality, which can be fragile.
| assertEquals( | ||
| "{\"transactionLinkId\":\"MC-TLID-123456789\"}", requestAdditionalData.toJson()); |
There was a problem hiding this comment.
Directly asserting the exact JSON string equality can be fragile and prone to failure if formatting, field order, or default serialization settings change in the future. Since contains is already used elsewhere in the codebase for simple JSON checks, consider using assertTrue with contains to make the assertion more robust.
assertTrue(requestAdditionalData.toJson().contains("\"transactionLinkId\":\"" + transactionLinkId + "\""));58c3847 to
3df40ff
Compare
|



Description
Tested scenarios
Fixed issue: