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.

@samsiegart samsiegart requested a review from turadg September 22, 2023 17:06
@samsiegart samsiegart force-pushed the fix-parse-non-sequenced branch from a3afc5c to 3f99f85 Compare September 22, 2023 17:09
@@ -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.

@samsiegart samsiegart force-pushed the fix-parse-non-sequenced branch from 3f99f85 to be75301 Compare September 22, 2023 22:37
@samsiegart samsiegart requested a review from turadg September 22, 2023 22:52
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