-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: test wasm crate in ci correctly (#1616)
* test: CI * fix: extract tests from src into tests so that they run as part of wasm-pack test * chore: make tests pass again --------- Co-authored-by: Atris <[email protected]>
- Loading branch information
Showing
4 changed files
with
202 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use ark_ff::Zero; | ||
use decaf377::Fq; | ||
use penumbra_asset::{ | ||
asset::{Id, Metadata}, | ||
Value, | ||
}; | ||
use penumbra_auction::auction::dutch::DutchAuctionDescription; | ||
use penumbra_num::Amount; | ||
use penumbra_proto::DomainType; | ||
use penumbra_wasm::auction::{get_auction_id, get_auction_nft_metadata}; | ||
use wasm_bindgen_test::wasm_bindgen_test; | ||
|
||
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); | ||
|
||
#[wasm_bindgen_test] | ||
fn it_gets_correct_id_and_metadata() { | ||
let description = DutchAuctionDescription { | ||
start_height: 0, | ||
end_height: 100, | ||
input: Value { | ||
amount: Amount::default(), | ||
asset_id: Id(Fq::zero()), | ||
}, | ||
min_output: Amount::default(), | ||
max_output: Amount::default(), | ||
nonce: [0; 32], | ||
output_id: Id(Fq::zero()), | ||
step_count: 100u64, | ||
}; | ||
|
||
let auction_id_bytes = get_auction_id(&description.encode_to_vec()).unwrap(); | ||
let result_bytes = get_auction_nft_metadata(&auction_id_bytes, 1234).unwrap(); | ||
let result = Metadata::decode::<&[u8]>(&result_bytes).unwrap(); | ||
let result_proto = result.to_proto(); | ||
|
||
assert!(result_proto.symbol.starts_with("auction@1234(")); | ||
assert!(result_proto.display.starts_with("auctionnft_1234_pauctid1")); | ||
} |
Oops, something went wrong.