Fix more tests.

This commit is contained in:
2019-01-22 11:16:04 +01:00
parent 8e0563b463
commit 0e32e8fa9c
8 changed files with 196 additions and 874 deletions

View File

@@ -127,6 +127,7 @@ impl Probe for Hitta {
#[cfg(test)]
mod tests {
use chrono::DateTime;
use pretty_assertions::assert_eq;
use super::*;
@@ -138,7 +139,153 @@ mod tests {
let expected = Entry {
messages: vec![],
history: vec!["42 andra har rapporterat detta nummer".to_string()],
comments: vec![],
comments: vec![
probe::Comment {
datetime: "2019-01-17T17:29:22Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Varmsälj från Folksam".to_string(),
},
probe::Comment {
datetime: "2018-12-14T13:45:28Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-11-28T07:30:18Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Höglandschskt".to_string(),
},
probe::Comment {
datetime: "2018-11-20T19:18:09Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Försäljare ".to_string(),
},
probe::Comment {
datetime: "2018-11-19T17:38:34Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "mögg från Folksam".to_string(),
},
probe::Comment {
datetime: "2018-11-12T16:00:41Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam försäkringsförsäljare".to_string(),
},
probe::Comment {
datetime: "2018-10-25T10:28:36Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "folksam".to_string(),
},
probe::Comment {
datetime: "2018-10-10T07:30:40Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Telefonförsäljare".to_string(),
},
probe::Comment {
datetime: "2018-10-04T10:04:55Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam säljare".to_string(),
},
probe::Comment {
datetime: "2018-10-03T13:55:19Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Sa inget.".to_string(),
},
probe::Comment {
datetime: "2018-08-24T16:56:46Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-08-24T09:42:43Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Achmati azmut från folksam".to_string(),
},
probe::Comment {
datetime: "2018-08-21T18:29:29Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-08-16T18:56:56Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Säljare från Folksam.".to_string(),
},
probe::Comment {
datetime: "2018-08-16T14:48:59Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam ".to_string(),
},
probe::Comment {
datetime: "2018-08-09T16:30:28Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-08-02T16:29:32Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam ".to_string(),
},
probe::Comment {
datetime: "2018-08-02T15:33:38Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam ".to_string(),
},
probe::Comment {
datetime: "2018-07-25T08:28:27Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Säljare Folksam".to_string(),
},
probe::Comment {
datetime: "2018-07-17T21:20:51Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Inga Hansson ".to_string(),
},
probe::Comment {
datetime: "2018-07-16T18:11:46Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-07-06T15:45:46Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam ".to_string(),
},
probe::Comment {
datetime: "2018-07-05T17:24:07Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "folksam".to_string(),
},
probe::Comment {
datetime: "2018-07-05T11:15:02Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Vesran".to_string(),
},
probe::Comment {
datetime: "2018-07-04T13:30:49Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam".to_string(),
},
probe::Comment {
datetime: "2018-06-29T10:52:51Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "folksam".to_string(),
},
probe::Comment {
datetime: "2018-06-28T13:33:01Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Säljare folksam".to_string(),
},
probe::Comment {
datetime: "2018-06-28T07:42:42Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Folksam försäkringar".to_string(),
},
probe::Comment {
datetime: "2018-06-26T12:59:33Z".parse::<DateTime<Utc>>().unwrap(),
title: "".to_string(),
message: "Säljare Folksam".to_string(),
},
],
};
assert_eq!(from_html(&document), Ok(expected));