~goorzhel/sota-slack-spotter

e9d507c6e4de0695cc47e3edf27fedc65c3b2652 — Antonio Gurgel a month ago da16d34
Add test for #5
3 files changed, 42 insertions(+), 1 deletions(-)

M src/test.rs
A src/test/null.json
M src/test/spot.json
M src/test.rs => src/test.rs +9 -0
@@ 120,3 120,12 @@ fn test_activations_cache() -> Result<()> {

    Ok(())
}

#[test]
fn test_issue_5() -> Result<()> {
    let null = include_str!("test/null.json").to_string();
    let spots: Vec<Spot> = serde_json::from_str(&null)?;
    assert!(spots.into_iter().all(|spot| spot.comments.is_none()));

    Ok(())
}

A src/test/null.json => src/test/null.json +32 -0
@@ 0,0 1,32 @@
[
    {
        "id": 659011,
        "userID": 0,
        "timeStamp": "2022-04-23T19:54:04.073",
        "comments": "",
        "callsign": "RBNHOLE",
        "associationCode": "W6",
        "summitCode": "NC-435",
        "activatorCallsign": "N6TNO",
        "activatorName": "Antonio",
        "frequency": "14.0515",
        "mode": "CW",
        "summitDetails": "Tiburon Peninsula, 228m, 1 pt",
        "highlightColor": "default"
    },
    {
        "id": 659012,
        "userID": 0,
        "timeStamp": "2022-04-23T19:54:05.073",
        "comments": null,
        "callsign": "RBNHOLE",
        "associationCode": "W6",
        "summitCode": "NC-435",
        "activatorCallsign": "N6TNO",
        "activatorName": "Antonio",
        "frequency": "14.0515",
        "mode": "CW",
        "summitDetails": "Tiburon Peninsula, 228m, 1 pt",
        "highlightColor": "default"
    }
]

M src/test/spot.json => src/test/spot.json +1 -1
@@ 14,4 14,4 @@
        "summitDetails": "Tiburon Peninsula, 228m, 1 pt",
        "highlightColor": "default"
    }
]
\ No newline at end of file
]