Skip to content

Commit 953ffa9

Browse files
committed
Suggestions for test helpers
1 parent be77dfa commit 953ffa9

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

zomes/hc_zome_trust_atom/src/lib.rs

+17-6
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ entry_defs![
3333

3434
#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
3535
pub struct TrustAtomInput {
36-
pub prefix: Option<String>,
37-
pub target: AnyLinkableHash,
36+
pub prefix: Option<String>,
37+
pub target: AnyLinkableHash,
3838
pub source: EntryHash, //// for testing purposes ////
3939
pub content: Option<String>,
4040
pub value: Option<String>,
@@ -45,8 +45,8 @@ pub target: AnyLinkableHash,
4545

4646
#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
4747
pub struct QueryInput {
48-
pub source: Option<AnyLinkableHash>,
49-
pub target: Option<AnyLinkableHash>,
48+
pub source: Option<AnyLinkableHash>,
49+
pub target: Option<AnyLinkableHash>,
5050
pub prefix: Option<String>,
5151
pub content_full: Option<String>,
5252
pub content_starts_with: Option<String>,
@@ -55,7 +55,7 @@ pub target: Option<AnyLinkableHash>,
5555

5656
#[derive(Serialize, Deserialize, SerializedBytes, Debug, Clone)]
5757
pub struct QueryMineInput {
58-
pub target: Option<AnyLinkableHash>,
58+
pub target: Option<AnyLinkableHash>,
5959
pub prefix: Option<String>,
6060
pub content_full: Option<String>,
6161
pub content_starts_with: Option<String>,
@@ -72,7 +72,6 @@ pub fn create_rollup_atoms(_: ()) -> ExternResult<Vec<TrustAtom>> {
7272
#[hdk_extern]
7373
pub fn create_trust_atom(input: TrustAtomInput) -> ExternResult<TrustAtom> {
7474
trust_atom::create_trust_atom(
75-
input.source,
7675
input.target,
7776
input.prefix,
7877
input.content,
@@ -110,6 +109,18 @@ pub fn query_mine(input: QueryMineInput) -> ExternResult<Vec<TrustAtom>> {
110109
}
111110
// TEST HELPERS
112111

112+
// #[hdk_extern]
113+
// pub fn test_helper_create_trust_atom(input: TrustAtomInput) -> ExternResult<TrustAtom> {
114+
// trust_atom::create_trust_atom(
115+
// input.source,
116+
// input.target,
117+
// input.prefix,
118+
// input.content,
119+
// input.value,
120+
// input.extra,
121+
// )
122+
// }
123+
113124
#[hdk_extern]
114125
pub fn create_string_target(input: String) -> ExternResult<EntryHash> {
115126
test_helpers::create_string_target(input)

zomes/hc_zome_trust_atom/src/trust_atom.rs

+15-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,21 @@ pub struct Extra {
4343
pub field: BTreeMap<String, String>,
4444
}
4545

46-
pub fn create_trust_atom(
46+
// pub fn create_trust_atom(
47+
// source: EntryHash, //// for tests ////
48+
// target: AnyLinkableHash,
49+
// prefix: Option<String>,
50+
// content: Option<String>,
51+
// value: Option<String>,
52+
// extra: Option<BTreeMap<String, String>>,
53+
// ) -> ExternResult<TrustAtom> {
54+
// set source to me
55+
// _create_trust_atom(
56+
// source: me
57+
// ...
58+
// )
59+
60+
pub fn _create_trust_atom(
4761
source: EntryHash, //// for tests ////
4862
target: AnyLinkableHash,
4963
prefix: Option<String>,

0 commit comments

Comments
 (0)