Skip to content

Commit

Permalink
chore(sync): add tests for cw implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
9Lukas5 committed Apr 16, 2023
1 parent 59a8bd3 commit 813b563
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,29 @@ QT test123: Original text"
assert_eq!(tweet.attachments[0].alt_text, Some("a".repeat(1_000)));
}

#[test]
fn tweet_add_content_warning() {
let fulltext = "blabalblabla";
let spoiler_text = "this is a unittest";
let expected = "CW: ".to_string() + spoiler_text + "\n\n" + fulltext;

assert_eq!(
expected,
add_content_warning_to_post_text(fulltext, spoiler_text)
);
}

#[test]
fn tweet_recognize_content_warning() {
let expected = "Some Unittest dude";
let decoded_tweet = "CW: ".to_string() + expected + "\nsome text";

assert_eq!(
expected,
tweet_find_content_warning(&decoded_tweet).unwrap()
);
}

pub fn get_mastodon_status() -> Status {
read_mastodon_status("src/mastodon_status.json")
}
Expand Down

0 comments on commit 813b563

Please sign in to comment.