A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
// SPDX-License-Identifier: AGPL-3.0-or-later
use fluxer_markdown_parser::{EmojiContext, MarkdownParser, ParserFlags};
use serde_json::{Value, json};
fn parse(input: &str) -> Value {
let mut parser = MarkdownParser::new(ParserFlags::ALL, EmojiContext::parse(""));
json!(parser.parse(input).expect("parse succeeds"))
}
#[test]
fn email_text_masks_only_its_own_mailto_address() {
assert_eq!(
parse("[[email protected]](mailto:[email protected])")[0]["type"],
"Link"
);
assert_eq!(
parse("[[email protected]](mailto:[email protected])")[0]["type"],
"Text"
);
assert_eq!(
parse("[[email protected]](https://example.com)")[0]["type"],
"Text"
);
}