-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Full code test coverage #31
Conversation
…e calling hdk_crud
2f85c20
to
3daec5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff... you are right about not testing the ones that use hdk_crud... better not to for now.
Let's go ahead and take that next step to create a fixturator for Profile.
You can see setting up a constructor for a struct isn't too hard, see here:
https://github.com/h-be/acorn/blob/c473a11155b3681d666ef42e57328ffe46252ca7/dna/zomes/projects/src/project/edge/crud.rs#L19-L33
Then make the series of types in the fixturator that you started match the list of types that the constructor takes.
dna/tests/src/test_lib.rs
Outdated
@@ -0,0 +1,57 @@ | |||
use hdk::prelude::*; | |||
|
|||
// should these be inside a module in this file? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// should these be inside a module in this file? |
let payload = ExternIO::encode(signal).unwrap(); | ||
let agents = vec![]; | ||
let remote_signal = RemoteSignal { | ||
signal: ExternIO::encode(payload).unwrap(), | ||
agents, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh so you got this part, well done
I think this is a good place to leave the test coverage for now. All the other public zome functions call hdk_crud functions. I don't think it makes sense testing those functions over here, what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is great, very good work!
my comment is mostly a follow up thing that we can do... I'd say this could be merged.
It'd be nice to have the files be formatted, there's an easy way to do that, over a whole project folder actually. It could be done as a follow up.
cargo fmt
within the folder of the crate.
It should be done as its own commit. Anyways, that's just another follow up.
This can get merged!
Next actions for you might be to capture these follow ups as issues, here, and in hdk_crud
fixturator!( | ||
WrappedHeaderHash; | ||
constructor fn new(HeaderHash); | ||
); | ||
|
||
fixturator!( | ||
WrappedAgentPubKey; | ||
constructor fn new(AgentPubKey); | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment is not for now, but for later...
these two themselves should go over into hdk_crud, since that is where these types are defined.
Also, tell me what you think of this... renaming WrappedHeaderHash to WrappedHeaderAddress and start making consistent at least for our stuff that terminology
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, the hdk uses HeaderHash and that is the type that is being wrapped changing it to address could be confusing for some? Plus Hash
uses a few less characters. Although I may be missing some important context as to why Address makes more sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah so you feel Hash could be the term to focus and land on. Fair. We will never be able to escape places in function names in the HDK where it says address but alas thats ok
Co-authored-by: Connor Turland <[email protected]>
update to hdk_crud 0.2.0
Currently have test coverage of public zome functions in the projects zome.
I left out test functions for
whoami
andfetch_agents
for now as they call hdk_crud functions and I'm not sure if we want to test those functions here. I see that you plan on doing test coverage over there eventually: lightningrodlabs/hdk_crud#1