[#13] Further overhaul of the project structure for better testing
This commit is contained in:
parent
e78de73d83
commit
2e73d88ae9
10 changed files with 48 additions and 16 deletions
|
|
@ -10,6 +10,7 @@ use std::convert::TryFrom;
|
|||
|
||||
/// This class is a simple wrapper around chrono's DateTime. Its sole purpose
|
||||
/// is to avoid error E0117.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct BasicDate(pub DateTime<Tz>);
|
||||
|
||||
/// This allows us to use BasicDate as a query parameter in our routes.
|
||||
|
|
@ -54,3 +55,15 @@ impl Serialize for BasicDate {
|
|||
serializer.serialize_str(&String::from(self))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_invalid_date() {
|
||||
let val = "2012-13-12";
|
||||
let date = BasicDate::try_from(val);
|
||||
assert_eq!(date, Err(FejError::InvalidArgument));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue