Skip to content

feat(datastore) adds more serialization/deserialization tests #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

giogam
Copy link
Contributor

@giogam giogam commented Jun 4, 2025

This adds tests to confirm that ordering is maintained across the JSON marshal/unmarshal of address_refs and contract_metadata. This will be expanded to also cover custom metadata fields

@giogam giogam requested a review from a team as a code owner June 4, 2025 14:22
Copy link

changeset-bot bot commented Jun 4, 2025

⚠️ No Changeset found

Latest commit: beb74f2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@giogam giogam force-pushed the giogam/datastore-serialization-ordering-tests branch from d5bcbcf to beb74f2 Compare June 4, 2025 14:38
@cl-sonarqube-production
Copy link

Copy link
Collaborator

@graham-chainlink graham-chainlink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good since datastore uses slice, so order is honoured

"number of records should match after unmarshaling")

// compare each record to ensure order is maintained
for i, originalRecord := range originalStore.Records {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, i prefer the comparison to be done with JSON string, this is more fool proof as that is essentially what we see in CLD

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Imagine some one implement MarshalJSON and ruin the ordering, this tests still pass but we dont get what we want anymore.

@giogam giogam closed this Jun 23, 2025
@graham-chainlink graham-chainlink deleted the giogam/datastore-serialization-ordering-tests branch June 23, 2025 07:59
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.

3 participants