Skip to content

Commit

Permalink
integration test for converting AP contentMap to HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Feb 7, 2025
1 parent 6be749e commit e7eca33
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,3 +996,31 @@ def test_atproto_convert_hashtag_to_activitypub_preserves_bsky_app_link(self):
'href': 'https://bsky.app/search?q=%23original',
}],
}, ActivityPub.convert(obj), ignore=['@context', 'attributedTo', 'to'])

def test_atproto_convert_link_to_activitypub_contentMap(self):
obj = Object(id='at://xyz', source_protocol='atproto', bsky={
'$type': 'app.bsky.feed.post',
'text': 'foo bar',
'langs': ['en'],
'facets': [{
'$type': 'app.bsky.richtext.facet',
'features': [{
'$type': 'app.bsky.richtext.facet#link',
'uri': 'http://bar',
}],
'index': {
'byteStart': 4,
'byteEnd': 7,
},
}],
})
self.assert_equals({
'type': 'Note',
'id': 'https://bsky.brid.gy/convert/ap/at://xyz',
'url': 'http://localhost/r/https://bsky.app/profile/xyz',
'content': '<p>foo <a href="http://bar">bar</a></p>',
'contentMap': {
'en': '<p>foo <a href="http://bar">bar</a></p>',
},
'tag': [{'name': 'bar', 'type': 'Article', 'url': 'http://bar'}],
}, ActivityPub.convert(obj), ignore=['@context', 'attributedTo', 'to'])

0 comments on commit e7eca33

Please sign in to comment.