Skip to content

Commit

Permalink
Add tests for urgency
Browse files Browse the repository at this point in the history
  • Loading branch information
kdheepak committed Oct 24, 2020
1 parent e5ecba3 commit b583ec1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ mod test {
"description": "test",
"entry": "20150619T165438Z",
"status": "waiting",
"uuid": "8ca953d5-18b4-4eb9-bd56-18f2e5b752f0"
"uuid": "8ca953d5-18b4-4eb9-bd56-18f2e5b752f0",
"urgency": 5.3
}"#;

println!("{}", s);
Expand All @@ -875,6 +876,7 @@ mod test {
assert!(
task.uuid().clone() == Uuid::parse_str("8ca953d5-18b4-4eb9-bd56-18f2e5b752f0").unwrap()
);
assert!(task.urgency() == Some(&5.3));

let back = serde_json::to_string(&task).unwrap();

Expand All @@ -885,6 +887,7 @@ mod test {
assert!(back.contains("status"));
assert!(back.contains("waiting"));
assert!(back.contains("uuid"));
assert!(back.contains("urgency"));
assert!(back.contains("8ca953d5-18b4-4eb9-bd56-18f2e5b752f0"));
}

Expand Down Expand Up @@ -919,6 +922,8 @@ mod test {
task.uuid().clone() == Uuid::parse_str("8ca953d5-18b4-4eb9-bd56-18f2e5b752f0").unwrap()
);

assert!(task.urgency() == Some(&0.583562));

assert!(task.modified() == Some(&mkdate("20160327T164007Z")));
assert!(task.project() == Some(&String::from("someproject")));

Expand Down Expand Up @@ -972,7 +977,7 @@ mod test {
{"entry":"20160423T125926Z","description":"Another Annotation"},
{"entry":"20160422T125942Z","description":"A Third Anno"}
],
"urgency": 0.583562
"urgency": -5
}"#;

println!("{}", s);
Expand All @@ -982,6 +987,8 @@ mod test {
assert!(task.is_ok());
let task: Task = task.unwrap();

assert!(task.urgency() == Some(&-5.0));

let all_annotations =
vec![
Annotation::new(mkdate("20160423T125911Z"), String::from("An Annotation")),
Expand Down Expand Up @@ -1113,6 +1120,7 @@ mod test {
assert!(t.project().is_some());
assert_eq!(t.project().unwrap(), "project");
assert!(t.tags().is_some());
assert!(t.urgency().is_none());
assert_eq!(
t.tags().unwrap(),
&vec!["search".to_owned(), "things".to_owned()]
Expand Down

0 comments on commit b583ec1

Please sign in to comment.