Skip to content

test(dto): pdf + support + bank account + buy payment info (+21 tests)#362

Merged
TaprootFreak merged 1 commit into
developfrom
test/pdf-support-dtos
May 15, 2026
Merged

test(dto): pdf + support + bank account + buy payment info (+21 tests)#362
TaprootFreak merged 1 commit into
developfrom
test/pdf-support-dtos

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 38 of the coverage push. Pure value-object + DTO file covering the PDF wire surface, the support issue ladder, BankAccount equatable contract and BuyPaymentInfo equality.

Cases

Target Cases
`MultiReceiptDto.toJson` 2 — default CHF; renames `txIds` → `txHashes`
`SingleReceiptDto.toJson` 2 — default CHF; renames `txId` → `txHash`
`PdfDto.fromJson` 1 — reads `pdfData`
`BalancePdfDto.toJson` 2 — default EN (uppercased on wire); override + uppercased language code
`SupportIssueType` 3 — round-trip; falls back to `genericIssue`; `toJson` returns the wire value
`SupportIssueReason` 2 — round-trip; falls back to `other`
`SupportIssueState` 2 — round-trip; falls back to `created`
`SupportIssueDto.fromJson` 2 — full happy path; absent `messages` → `[]`
`SupportIssue` 2 — `isOpen` for `created` / `pending` only; `fromDto` maps fields
`BankAccount` 2 — equality by `id` only; `isActive` defaults to false
`BuyPaymentInfo` 1 — equatable props pin every field (currency-mismatch breaks equality)

What's pinned

  • The two-step `txId` rename (`txId` → `txHash`, `txIds` → `txHashes`) is locked on both `SingleReceiptDto` and `MultiReceiptDto`.
  • `BalancePdfDto` uppercases `Language.code` (`en` → `EN`) on the wire — a silent lowercase would break the contract.
  • All three support enums use `firstWhere(... orElse: ...)` to fall back to a sentinel on unknown wire values; each fallback is pinned by name so refactors can't silently change which sentinel returns.
  • `SupportIssueDto.messages` is optional on the wire and resolves to an empty list, not null.
  • `BankAccount` Equatable `props` is `[id]` only — two accounts with the same id compare equal even if name / iban / isActive differ.
  • `BuyPaymentInfo` props enumerate every field — the negative case (currency difference) is the canary.

Test plan

  • `flutter test test/packages/service/dfx/models/pdf_support_bank_test.dart` — 21 pass
  • `flutter analyze` clean on the new file
  • CI green

Stage 38 of the coverage push. Pure value-object + DTO file
covering PDF wire surface, support issue ladder, BankAccount
equatable contract and BuyPaymentInfo equality.

- MultiReceiptDto.toJson (2): defaults CHF; renames txIds → txHashes
- SingleReceiptDto.toJson (2): defaults CHF; renames txId → txHash
- PdfDto.fromJson (1): reads pdfData
- BalancePdfDto.toJson (2): default EN (uppercased on wire);
  override + uppercased language code
- SupportIssueType (3): round-trip; falls back to genericIssue;
  toJson returns wire value
- SupportIssueReason (2): round-trip; falls back to other
- SupportIssueState (2): round-trip; falls back to created
- SupportIssueDto.fromJson (2): full happy path; absent messages → []
- SupportIssue (2): isOpen for created/pending only; fromDto maps fields
- BankAccount (2): equality by id only; isActive defaults to false
- BuyPaymentInfo (1): equatable props pin every field
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 19:01
@TaprootFreak TaprootFreak merged commit f511093 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/pdf-support-dtos branch May 15, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant