Fixing broken test
This commit is contained in:
@@ -36,6 +36,11 @@ fn ensure_side_directory_exists(side_dir: &PathBuf) -> Result<(), std::io::Error
|
|||||||
mod tests {
|
mod tests {
|
||||||
use std::{fs, path::Path};
|
use std::{fs, path::Path};
|
||||||
|
|
||||||
|
use fastcrypto::{
|
||||||
|
ed25519::Ed25519KeyPair,
|
||||||
|
traits::{EncodeDecodeBase64, KeyPair, ToFromBytes},
|
||||||
|
};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
fn default_side_node_config() -> SideNodeConfig {
|
fn default_side_node_config() -> SideNodeConfig {
|
||||||
@@ -69,8 +74,9 @@ mod tests {
|
|||||||
assert!(file_path.exists());
|
assert!(file_path.exists());
|
||||||
|
|
||||||
// check that the pem is readable
|
// check that the pem is readable
|
||||||
let pem = fs::read_to_string(file_path).unwrap();
|
let data = fs::read_to_string(file_path).expect("couldn't read key file");
|
||||||
assert!(pem::parse_many(&pem).is_ok());
|
let keys = Ed25519KeyPair::decode_base64(&data).expect("couldn't load keypair from file");
|
||||||
|
assert_eq!(keys.public().as_bytes().len(), 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use bft_crdt_derive::add_crdt_fields;
|
|||||||
|
|
||||||
use bft_json_crdt::{
|
use bft_json_crdt::{
|
||||||
json_crdt::{BaseCrdt, CrdtNode, IntoCrdtNode},
|
json_crdt::{BaseCrdt, CrdtNode, IntoCrdtNode},
|
||||||
keypair::{make_keypair, Ed25519KeyPair, KeyPair},
|
keypair::{Ed25519KeyPair, KeyPair},
|
||||||
list_crdt::ListCrdt,
|
list_crdt::ListCrdt,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -31,7 +31,6 @@ pub(crate) struct Transaction {
|
|||||||
|
|
||||||
pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
|
pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
|
||||||
let keys = keys::load_from_file(side_dir);
|
let keys = keys::load_from_file(side_dir);
|
||||||
// let keys = make_keypair();
|
|
||||||
let bft_crdt = BaseCrdt::<CrdtList>::new(&keys);
|
let bft_crdt = BaseCrdt::<CrdtList>::new(&keys);
|
||||||
println!("Author is {}", keys.public().to_string());
|
println!("Author is {}", keys.public().to_string());
|
||||||
(bft_crdt, keys)
|
(bft_crdt, keys)
|
||||||
|
|||||||
Reference in New Issue
Block a user