Commit 8c7e3ce2 authored by Éloïs's avatar Éloïs

[tests] add test parse_doc_into_json

parent 34c6662a
......@@ -5,14 +5,26 @@
extern crate dup_tools_wasm;
extern crate wasm_bindgen_test;
use dup_tools_wasm::*;
use dup_tools_wasm::crypto::*;
use dup_tools_wasm::parsers::*;
use wasm_bindgen_test::*;
wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
fn pass() {
assert_eq!(1 + 1, 2);
fn test_parse_idty_v10() {
let doc = "Version: 10
Type: Identity
Currency: duniter_unit_test_currency
Issuer: DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV
UniqueID: tic
Timestamp: 0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855
1eubHHbuNfilHMM0G2bI30iZzebQ2cQ1PC7uPAw08FGMMmQCRerlF/3pc4sAcsnexsxBseA/3lY03KlONqJBAg==";
assert_eq!(
parse_doc_into_json(doc, DocumentType::IdentityV10),
"{\n \"currency\": \"duniter_unit_test_currency\",\n \"username\": \"tic\",\n \"blockstamp\": \"0-E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855\",\n \"issuer\": \"DNann1Lh55eZMEDXeYt59bzHbA3NJR46DeQYCS2qQdLV\",\n \"signature\": \"1eubHHbuNfilHMM0G2bI30iZzebQ2cQ1PC7uPAw08FGMMmQCRerlF/3pc4sAcsnexsxBseA/3lY03KlONqJBAg==\"\n}".to_owned()
);
}
#[wasm_bindgen_test]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment