Fixing broken test

This commit is contained in:
Dave Hrycyszyn
2024-06-06 18:55:48 +01:00
parent cda6dd2901
commit da29d681d8
2 changed files with 9 additions and 4 deletions

View File

@@ -36,6 +36,11 @@ fn ensure_side_directory_exists(side_dir: &PathBuf) -> Result<(), std::io::Error
mod tests {
use std::{fs, path::Path};
use fastcrypto::{
ed25519::Ed25519KeyPair,
traits::{EncodeDecodeBase64, KeyPair, ToFromBytes},
};
use super::*;
fn default_side_node_config() -> SideNodeConfig {
@@ -69,8 +74,9 @@ mod tests {
assert!(file_path.exists());
// check that the pem is readable
let pem = fs::read_to_string(file_path).unwrap();
assert!(pem::parse_many(&pem).is_ok());
let data = fs::read_to_string(file_path).expect("couldn't read key file");
let keys = Ed25519KeyPair::decode_base64(&data).expect("couldn't load keypair from file");
assert_eq!(keys.public().as_bytes().len(), 32);
}
#[test]

View File

@@ -4,7 +4,7 @@ use bft_crdt_derive::add_crdt_fields;
use bft_json_crdt::{
json_crdt::{BaseCrdt, CrdtNode, IntoCrdtNode},
keypair::{make_keypair, Ed25519KeyPair, KeyPair},
keypair::{Ed25519KeyPair, KeyPair},
list_crdt::ListCrdt,
};
@@ -31,7 +31,6 @@ pub(crate) struct Transaction {
pub(crate) fn new(side_dir: PathBuf) -> (BaseCrdt<CrdtList>, Ed25519KeyPair) {
let keys = keys::load_from_file(side_dir);
// let keys = make_keypair();
let bft_crdt = BaseCrdt::<CrdtList>::new(&keys);
println!("Author is {}", keys.public().to_string());
(bft_crdt, keys)