Skip to content

Commit

Permalink
Suggestions for test helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
harlantwood committed May 27, 2022
1 parent 9c5ecad commit aaac3dd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
23 changes: 17 additions & 6 deletions zomes/hc_zome_trust_atom/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ entry_defs![

#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
pub struct TrustAtomInput {
pub prefix: Option<String>,
pub target: AnyLinkableHash,
pub prefix: Option<String>,
pub target: AnyLinkableHash,
pub source: EntryHash, //// for testing purposes ////
pub content: Option<String>,
pub value: Option<String>,
Expand All @@ -45,8 +45,8 @@ pub target: AnyLinkableHash,

#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
pub struct QueryInput {
pub source: Option<AnyLinkableHash>,
pub target: Option<AnyLinkableHash>,
pub source: Option<AnyLinkableHash>,
pub target: Option<AnyLinkableHash>,
pub prefix: Option<String>,
pub content_full: Option<String>,
pub content_starts_with: Option<String>,
Expand All @@ -55,7 +55,7 @@ pub target: Option<AnyLinkableHash>,

#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
pub struct QueryMineInput {
pub target: Option<AnyLinkableHash>,
pub target: Option<AnyLinkableHash>,
pub prefix: Option<String>,
pub content_full: Option<String>,
pub content_starts_with: Option<String>,
Expand All @@ -72,7 +72,6 @@ pub fn create_rollup_atoms(_: ()) -> ExternResult<Vec<TrustAtom>> {
#[hdk_extern]
pub fn create_trust_atom(input: TrustAtomInput) -> ExternResult<TrustAtom> {
trust_atom::create_trust_atom(
input.source,
input.target,
input.prefix,
input.content,
Expand Down Expand Up @@ -110,6 +109,18 @@ pub fn query_mine(input: QueryMineInput) -> ExternResult<Vec<TrustAtom>> {
}
// TEST HELPERS

// #[hdk_extern]
// pub fn test_helper_create_trust_atom(input: TrustAtomInput) -> ExternResult<TrustAtom> {
// trust_atom::create_trust_atom(
// input.source,
// input.target,
// input.prefix,
// input.content,
// input.value,
// input.extra,
// )
// }

#[hdk_extern]
pub fn create_string_target(input: String) -> ExternResult<EntryHash> {
test_helpers::create_string_target(input)
Expand Down
16 changes: 15 additions & 1 deletion zomes/hc_zome_trust_atom/src/trust_atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,21 @@ pub struct Extra {
pub field: BTreeMap<String, String>,
}

pub fn create_trust_atom(
// pub fn create_trust_atom(
// source: EntryHash, //// for tests ////
// target: AnyLinkableHash,
// prefix: Option<String>,
// content: Option<String>,
// value: Option<String>,
// extra: Option<BTreeMap<String, String>>,
// ) -> ExternResult<TrustAtom> {
// set source to me
// _create_trust_atom(
// source: me
// ...
// )

pub fn _create_trust_atom(
source: EntryHash, //// for tests ////
target: AnyLinkableHash,
prefix: Option<String>,
Expand Down

0 comments on commit aaac3dd

Please sign in to comment.