Skip to content

Upgrade deps; Correct issues from upgrade; Setup jest unit tests for sanitizeNumbers;#90

Merged
joepetrowski merged 12 commits intomasterfrom
zeke-test-sanitizeNumbers
Jul 8, 2020
Merged

Upgrade deps; Correct issues from upgrade; Setup jest unit tests for sanitizeNumbers;#90
joepetrowski merged 12 commits intomasterfrom
zeke-test-sanitizeNumbers

Conversation

@emostov
Copy link
Contributor

@emostov emostov commented Jun 16, 2020

Closes #89

Motivation:

While writing testing for santizeNumbers I bumped @polkadot/api from 1.23.0.beta2 to 1.23.1 and the tests I wrote for Compact<Balance> started failing. I also realized the server would not start due to several u32 types being created with a -1. I later found that it was failing on an enum type in Vec<BalanceLock> so I added enum handling to sanitizeNumbers as well. I figured the best move would be to just fix all the issues in one go since async coordination of dependent merges could be considered unnecessarily slow and tricky given the context.

Overview:

  • Upgrade all deps
  • Add tests for sanitizeNumbers
  • Correct sanitizeNumbers to correctly handle new Compact format
  • Change all occurrences of createType('u32', -1) to createType('u32', 0) in order to not trigger the new validation error
  • Update CI to incorporate testing

Future PRs

Test extended types

Test AbstractInt as value in object

sanitize a staking response

Fix some small details
@emostov emostov force-pushed the zeke-test-sanitizeNumbers branch from efc7f33 to d958830 Compare June 16, 2020 04:57
@emostov emostov marked this pull request as ready for review July 7, 2020 02:02
@emostov emostov changed the title Setup Jest and sanity check sanitizeNumbers Upgrade deps; Correct issues from upgrade; Setup jest unit tests for sanitizeNumbers; Jul 7, 2020
Correct workflow to install wasm-pack

Try again
@emostov emostov force-pushed the zeke-test-sanitizeNumbers branch from ba55b53 to 1f9d86d Compare July 7, 2020 02:07
@emostov emostov requested review from danforbes and joepetrowski and removed request for danforbes and joepetrowski July 7, 2020 02:16
Copy link
Collaborator

@joepetrowski joepetrowski 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, just a few questions and edge cases I'm wondering about.

Comment on lines +45 to +47
total: '0x0000000000000000ff49f24a6a9c00',
active: '0x0000000000000000ff49f24a6a9100',
unlocking: [],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a real example? Normally total = active + unlocking.sum(). It should work because that shouldn't affect sanitizeNumbers, but I don't think it's an actual state.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also why are these 15 bytes? Should be 16, no?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's work on this in follow ups, but shouldn't block this.

Use async create instead of initialize

Add versionReset; Revert static creat

Remove exclamation maarks

Put comment back in

Revert last commit

Delete stray empty line

Revert ensureMeta changes

Clean up testing

Save progress with U64s

Fix issues with BTreeSet

More tests

Update to handle in option so linkage test passes

save progress on set

More tests

Save progress

last tests
@emostov emostov force-pushed the zeke-test-sanitizeNumbers branch from 9a2c79e to 5fc3a27 Compare July 8, 2020 05:28
@joepetrowski joepetrowski merged commit f4f1028 into master Jul 8, 2020
@joepetrowski joepetrowski deleted the zeke-test-sanitizeNumbers branch July 8, 2020 07: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.

Use jest to unit test sanitizeNumbers

2 participants