Skip to content
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

fix: parse non-sequenced data correctly #48

Merged
merged 2 commits into from
Sep 26, 2023
Merged

Conversation

samsiegart
Copy link
Contributor

No description provided.

@@ -90,7 +90,7 @@ describe('makeAgoricChainStorageWatcher', () => {
});

it('can handle unserialized values', async () => {
const expected = 126560000000;
const expected = 'abc123';
Copy link
Member

Choose a reason for hiding this comment

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

is this the only thing we need to test to have confidence?

also it's a little funny to start out with expected. consider originaalValue as the simple value being passed around . Or value and qualify the one come from chain storage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The difference is that JSON.parse('abc123') throws while JSON.parse(126560000000) does not, so this test fails without the fix and passes with the fix. I just updated the test util to not stringify the value either to be sure. We could add a bunch of different cases with different data but I don't know if it's necessary when the distinction is: can it be parsed as JSON or not.

The expected thing is used everywhere in the test file, I'm not sold on originalValue because it could be taken to imply the value changed, which we have a specific test for, I'd rather just keep as is.

Copy link
Member

@turadg turadg left a comment

Choose a reason for hiding this comment

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

Fix, rest and rationale lgmt.

I pushed a commit to deduplicate the yarn.lock

@samsiegart samsiegart merged commit 7c365a1 into main Sep 26, 2023
1 check passed
@samsiegart samsiegart deleted the fix-parse-non-sequenced branch September 26, 2023 05:05
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