Skip to content

Commit

Permalink
refactor: Use libipld_core::serde::to_ipld instead of dag-cbor
Browse files Browse the repository at this point in the history
  • Loading branch information
matheus23 committed Feb 15, 2024
1 parent 3e2ae56 commit 500a6c2
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions wnfs/src/private/keys/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,11 @@ impl From<&AccessKey> for Vec<u8> {
#[cfg(test)]
mod snapshot_tests {
use super::*;
use libipld_core::ipld::Ipld;
use rand::Rng;
use rand_chacha::ChaCha12Rng;
use rand_core::SeedableRng;
use testresult::TestResult;
use wnfs_common::{
decode, encode,
libipld::{cbor::DagCborCodec, json::DagJsonCodec},
};
use wnfs_common::{encode, libipld::json::DagJsonCodec};

#[async_std::test]
async fn test_access_key() -> TestResult {
Expand All @@ -154,9 +150,7 @@ mod snapshot_tests {
}

fn as_dag_json_value(s: impl Serialize) -> Result<serde_json::Value> {
let dag_cbor = encode(&s, DagCborCodec)?;
let ipld: Ipld = decode(&dag_cbor, DagCborCodec)?;
let dag_json = encode(&ipld, DagJsonCodec)?;
let dag_json = encode(&libipld_core::serde::to_ipld(s)?, DagJsonCodec)?;
let value = serde_json::from_slice(&dag_json)?;
Ok(value)
}
Expand Down

0 comments on commit 500a6c2

Please sign in to comment.