-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from h-be/full-test-coverage
Full code test coverage
- Loading branch information
Showing
37 changed files
with
662 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
// in this file, you will see instances of setting up a type alias, such as `type OptionVecString = Option<Vec<String>>;` | ||
// this is done to enable passing those to constructor functions for fixturators, like | ||
// ``` | ||
// fixturator!( | ||
// Goal; | ||
// constructor fn new(..., OptionVecString, ...); | ||
// ); | ||
// ``` | ||
#[cfg(test)] | ||
pub(crate) mod fixtures { | ||
use ::fixt::prelude::*; | ||
use hdk::prelude::*; | ||
use hdk_crud::{WrappedAgentPubKey, WrappedHeaderHash}; | ||
use profiles::profile::{Profile, Status as ProfileStatus}; | ||
use projects::project::goal::crud::{Goal, Hierarchy, Status}; | ||
use projects::project::{ | ||
edge::crud::Edge, | ||
entry_point::crud::EntryPoint, | ||
goal::crud::TimeFrame, | ||
goal_comment::crud::GoalComment, | ||
goal_member::crud::GoalMember, | ||
goal_vote::crud::GoalVote, | ||
member::entry::Member, | ||
project_meta::crud::{PriorityMode, ProjectMeta}, | ||
}; | ||
|
||
fixturator!( | ||
WrappedHeaderHash; | ||
constructor fn new(HeaderHash); | ||
); | ||
|
||
fixturator!( | ||
WrappedAgentPubKey; | ||
constructor fn new(AgentPubKey); | ||
); | ||
|
||
fixturator!( | ||
Edge; | ||
constructor fn new(WrappedHeaderHash, WrappedHeaderHash, f64, bool); | ||
); | ||
|
||
fixturator!( | ||
EntryPoint; | ||
constructor fn new(String, WrappedAgentPubKey, f64, WrappedHeaderHash, bool); | ||
); | ||
|
||
fixturator!( | ||
GoalMember; | ||
constructor fn new(WrappedHeaderHash, WrappedAgentPubKey, WrappedAgentPubKey, f64, bool); | ||
); | ||
|
||
fixturator!( | ||
GoalComment; | ||
constructor fn new(WrappedHeaderHash, String, WrappedAgentPubKey, f64, bool); | ||
); | ||
|
||
fixturator!( | ||
GoalVote; | ||
constructor fn new(WrappedHeaderHash, f64, f64, f64, f64, WrappedAgentPubKey, f64, bool); | ||
); | ||
|
||
fixturator!( | ||
Member; | ||
constructor fn new(WrappedAgentPubKey); | ||
); | ||
|
||
fixturator!( | ||
ProjectMeta; | ||
constructor fn new(WrappedAgentPubKey, f64, String, OptionString, String, bool, PriorityMode, VecWrappedHeaderHash); | ||
); | ||
|
||
type VecWrappedHeaderHash = Vec<WrappedHeaderHash>; | ||
type OptionWrappedAgentPubKey = Option<WrappedAgentPubKey>; | ||
type OptionString = Option<String>; | ||
type Optionf64 = Option<f64>; | ||
type OptionVecString = Option<Vec<String>>; | ||
type OptionTimeFrame = Option<TimeFrame>; | ||
|
||
fixturator!( | ||
PriorityMode; | ||
unit variants [ Universal Vote ] empty Universal; | ||
); | ||
|
||
fixturator!( | ||
TimeFrame; | ||
constructor fn new(f64, f64); | ||
); | ||
|
||
fixturator!( | ||
Status; | ||
unit variants [ Uncertain Incomplete InProcess Complete InReview ] empty Uncertain; | ||
); | ||
|
||
fixturator!( | ||
Hierarchy; | ||
unit variants [Root Trunk Branch Leaf NoHierarchy ] empty NoHierarchy; | ||
); | ||
|
||
fixturator!( | ||
VecWrappedHeaderHash; | ||
curve Empty { | ||
Vec::new() | ||
}; | ||
curve Unpredictable { | ||
vec![WrappedHeaderHashFixturator::new(Unpredictable).next().unwrap()] | ||
}; | ||
curve Predictable { | ||
vec![WrappedHeaderHashFixturator::new(Predictable).next().unwrap()] | ||
}; | ||
); | ||
|
||
fixturator!( | ||
OptionWrappedAgentPubKey; | ||
curve Empty { | ||
None | ||
}; | ||
curve Unpredictable { | ||
Some(WrappedAgentPubKeyFixturator::new(Unpredictable).next().unwrap()) | ||
}; | ||
curve Predictable { | ||
Some(WrappedAgentPubKeyFixturator::new(Predictable).next().unwrap()) | ||
}; | ||
); | ||
|
||
fixturator!( | ||
OptionString; | ||
curve Empty { | ||
None | ||
}; | ||
curve Unpredictable { | ||
Some(fixt!(String)) | ||
}; | ||
curve Predictable { | ||
Some(fixt!(String, Predictable)) | ||
}; | ||
); | ||
|
||
fixturator!( | ||
Optionf64; | ||
curve Empty { | ||
None | ||
}; | ||
curve Unpredictable { | ||
Some(fixt!(f64)) | ||
}; | ||
curve Predictable { | ||
Some(fixt!(f64, Predictable)) | ||
}; | ||
); | ||
|
||
fixturator!( | ||
OptionVecString; | ||
curve Empty { | ||
None | ||
}; | ||
curve Unpredictable { | ||
Some(Vec::new()) | ||
}; | ||
curve Predictable { | ||
Some(Vec::new()) | ||
}; | ||
); | ||
|
||
fixturator!( | ||
OptionTimeFrame; | ||
curve Empty { | ||
None | ||
}; | ||
curve Unpredictable { | ||
Some(TimeFrameFixturator::new(Unpredictable).next().unwrap()) | ||
}; | ||
curve Predictable { | ||
Some(TimeFrameFixturator::new(Predictable).next().unwrap()) | ||
}; | ||
); | ||
|
||
fixturator!( | ||
Goal; | ||
constructor fn new(String, WrappedAgentPubKey, OptionWrappedAgentPubKey, f64, Optionf64, Hierarchy, Status, OptionVecString, String, OptionTimeFrame, bool); | ||
); | ||
fixturator!( | ||
ProfileStatus; | ||
unit variants [ Online Away Offline ] empty Offline; | ||
); | ||
fixturator!( | ||
Profile; | ||
constructor fn new(String, String, String, ProfileStatus, String, WrappedAgentPubKey, bool); | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
mod project; | ||
mod project; | ||
mod profiles; | ||
mod test_lib; | ||
mod fixtures; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod profile; |
Oops, something went wrong.