Skip to content

Add property-based tests for simplest JSON converters#94

Merged
SeanTAllen merged 1 commit intomainfrom
add-json-converter-tests
Mar 2, 2026
Merged

Add property-based tests for simplest JSON converters#94
SeanTAllen merged 1 commit intomainfrom
add-json-converter-tests

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

First step toward testing the library's 24 JSON converter primitives. These are pure functions (JSON in -> model out) testable without network access.

Two property-based tests per converter:

  • Preserves values — generate random valid JSON, convert, assert each model field matches the input. Uses distinct prefixed values so a copy-paste bug (reading wrong JSON key) always fails.
  • Missing field — generate valid JSON minus one randomly-chosen field, assert the converter raises an error.

Converters tested: GitPersonJsonConverter (2 strings), LicenseJsonConverter (5 strings), CommitFileJsonConverter (3 strings), GistChangeStatusJsonConverter (3 I64s).

Design: #93

First step toward testing the library's 24 JSON converter primitives.
These are pure functions (JSON in -> model out) testable without network
access.

Two property-based tests per converter:
- Preserves values: random valid JSON roundtrips with correct field values
- Missing field: omitting any single required field causes an error

Converters tested: GitPersonJsonConverter, LicenseJsonConverter,
CommitFileJsonConverter, GistChangeStatusJsonConverter.

Design: #93
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 2, 2026
@SeanTAllen SeanTAllen merged commit 142baa4 into main Mar 2, 2026
10 checks passed
@SeanTAllen SeanTAllen deleted the add-json-converter-tests branch March 2, 2026 21:05
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 2, 2026
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.

2 participants