Skip to content

test(kyc): financial DTOs + KycLevelDto (+10 tests)#363

Merged
TaprootFreak merged 1 commit into
developfrom
test/kyc-financial-dtos
May 15, 2026
Merged

test(kyc): financial DTOs + KycLevelDto (+10 tests)#363
TaprootFreak merged 1 commit into
developfrom
test/kyc-financial-dtos

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Summary

Stage 39 of the coverage push. Pure-DTO tests for the KYC financial-data wire surface plus the `KycLevelDto` wrapper that ties `KycLevel` to a list of `KycStepDto`.

Cases

Target Cases
`QuestionType.fromValue` 2 — four documented wire values (`Confirmation` / `SingleChoice` / `MultipleChoice` / `Text`); throws `ArgumentError` on unknown
`KycFinancialOption.fromJson` 1 — key + text
`KycFinancialCondition.fromJson` 1 — question + response
`KycFinancialQuestion.fromJson` 2 — happy path (description + options + conditions); description / options / conditions all optional
`KycFinancialResponse` 1 — `fromJson` + `toJson` round-trip
`KycFinancialOutData.fromJson` 2 — with responses; absent `responses` defaults to `[]`
`KycLevelDto.fromJson` 1 — `kycLevel` + nested `KycStepDto` list

What's pinned

  • `QuestionType.fromValue` is opt-in strict (throws on unknown wire values) unlike the support enums which fall back to a sentinel — pinned by both the happy path and the negative case.
  • `KycFinancialQuestion` treats `description`, `options` and `conditions` as fully optional — wire-side `null` survives as Dart `null`, not an empty list.
  • `KycFinancialOutData.responses` defaults to `[]` when the key is absent (not `null`), distinguishing it from the question-side optionals.

Test plan

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

Stage 39 of the coverage push. Pure-DTO tests for the KYC
financial-data wire surface and KycLevelDto wrapper.

- QuestionType.fromValue (2): four documented wire values
  (Confirmation/SingleChoice/MultipleChoice/Text) +
  ArgumentError on unknown
- KycFinancialOption.fromJson (1)
- KycFinancialCondition.fromJson (1)
- KycFinancialQuestion.fromJson (2): full happy path with
  options + conditions; description/options/conditions all
  optional
- KycFinancialResponse (1): fromJson + toJson round-trip
- KycFinancialOutData.fromJson (2): with responses; absent
  responses defaults to []
- KycLevelDto.fromJson (1): kycLevel + nested KycStepDto list
@TaprootFreak TaprootFreak marked this pull request as ready for review May 15, 2026 19:01
@TaprootFreak TaprootFreak merged commit dcfc4d6 into develop May 15, 2026
1 check passed
@TaprootFreak TaprootFreak deleted the test/kyc-financial-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