Skip to content
This repository has been archived by the owner on Feb 26, 2020. It is now read-only.

Derivation functions (hard/soft for pair, soft for public) #11

Merged
merged 1 commit into from
Mar 23, 2019

Conversation

jacogr
Copy link
Contributor

@jacogr jacogr commented Mar 23, 2019

Tested via cargo test by swapping the #[wasm_bindgen_test] to #[test] for hard_derives_pair, soft_derives_pair & soft_derives_public, there are no WASM-specific tests included here.

This basically is the code from https://github.com/polkadot-js/wasm/blob/master/packages/wasm-schnorrkel/src/lib.rs#L64-L104 adjusted fitting in with the conventions used here

Addresses #9

With the above macro swap, this is my outputs -

 $ cargo test
   Compiling schnorrkel-js v0.2.0 (/Users/jacogreeff/Projects/paritytech/schnorrkel-js)
    Finished dev [unoptimized + debuginfo] target(s) in 4.52s
     Running target/debug/deps/schnorrkel_js-13f16448e9949324

running 3 tests
test tests::hard_derives_pair ... ok
test tests::soft_derives_pair ... ok
test tests::soft_derives_public ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

(As mentioned, no JS WASM tests here)

@kianenigma
Copy link
Collaborator

You could also test this with either of wasm-pack test --node or --chrome (second one needs a line of change).

 [1/5] Checking `rustc` version...
  [2/5] Adding WASM target...
  info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date
  [3/5] Compiling tests to WASM...
     Compiling schnorrkel-js v0.2.0 (/home/kianenigma/Desktop/Parity/schnorrkel-js)
      Finished dev [unoptimized + debuginfo] target(s) in 0.38s
  [4/5] Installing wasm-bindgen...
  [5/5] Running tests in node...
      Finished dev [unoptimized + debuginfo] target(s) in 0.04s
       Running target/wasm32-unknown-unknown/debug/deps/schnorrkel_js-e4072c135dde42d9.wasm
running 7 tests                                     
  
  test schnorrkel_js::tests::soft_derives_public ... ok
  test schnorrkel_js::tests::soft_derives_pair ... ok
  test schnorrkel_js::tests::hard_derives_pair ... ok
  test schnorrkel_js::tests::can_verify_message ... ok
  test schnorrkel_js::tests::can_sign_message ... ok
  test schnorrkel_js::tests::can_create_secret ... ok
  test schnorrkel_js::tests::can_create_keypair ... ok
  
  test result: ok. 7 passed; 0 failed; 0 ignored

what was the reason?

@kianenigma kianenigma merged commit 368aae4 into master Mar 23, 2019
@jacogr
Copy link
Contributor Author

jacogr commented Mar 23, 2019

Since I have specific require-as-compiled-and-execute-JS node and jest tests (the second being problematic for me in the past for various reasons), I never use the WASM-pack variants manually (Same on the Travis CI that builds and publishes)

@jacogr jacogr deleted the jg-derive branch March 23, 2019 12:42
@jacogr
Copy link
Contributor Author

jacogr commented Mar 23, 2019

(The same JS tests actually get used against asm.js versions as well - that is a whole other battle to get going smoothly)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants