diff --git a/app/soapbox/__fixtures__/friendica-status.json b/app/soapbox/__fixtures__/friendica-status.json new file mode 100644 index 000000000..fc64e430e --- /dev/null +++ b/app/soapbox/__fixtures__/friendica-status.json @@ -0,0 +1,53 @@ +{ + "id": "106", + "created_at": "2022-02-19T18:19:40.000Z", + "in_reply_to_id": null, + "in_reply_to_account_id": null, + "sensitive": false, + "spoiler_text": "", + "visibility": "public", + "language": "fa", + "uri": "https://ica.mkljczk.pl/objects/68a16c11-4262-1134-bc4e-0db298374337", + "url": "https://ica.mkljczk.pl/display/68a16c11-4262-1134-bc4e-0db298374337", + "replies_count": 0, + "reblogs_count": 0, + "favourites_count": 0, + "favourited": false, + "reblogged": false, + "muted": false, + "bookmarked": true, + "content": "Hello to Friendica from fe.soapbox.pub!", + "reblog": null, + "application": { + "name": "Soapbox FE" + }, + "account": { + "id": "95", + "username": "alex", + "acct": "alex", + "display_name": "Alex Gleason", + "locked": true, + "bot": false, + "discoverable": false, + "group": false, + "created_at": "2022-02-19T18:17:43.000Z", + "note": "", + "url": "https://ica.mkljczk.pl/profile/alex", + "avatar": "https://ica.mkljczk.pl/photo/contact/300/68a16c11-1862-1134-4779-f98088458845?ts=1645294804", + "avatar_static": "https://ica.mkljczk.pl/photo/contact/300/68a16c11-1862-1134-4779-f98088458845?ts=1645294804", + "header": "https://ica.mkljczk.pl/photo/header/68a16c11-1862-1134-4779-f98088458845?ts=1645294804", + "header_static": "https://ica.mkljczk.pl/photo/header/68a16c11-1862-1134-4779-f98088458845?ts=1645294804", + "followers_count": 0, + "following_count": 0, + "statuses_count": 2, + "last_status_at": "2022-02-19", + "emojis": [], + "fields": [] + }, + "media_attachments": [], + "mentions": [], + "tags": [], + "emojis": [], + "card": null, + "poll": null +} diff --git a/app/soapbox/normalizers/__tests__/status-test.js b/app/soapbox/normalizers/__tests__/status-test.js index 8e32555a8..c582d230d 100644 --- a/app/soapbox/normalizers/__tests__/status-test.js +++ b/app/soapbox/normalizers/__tests__/status-test.js @@ -105,4 +105,33 @@ describe('normalizeStatus', () => { expect(result.get('quote')).toEqual(status.getIn(['pleroma', 'quote'])); expect(result.getIn(['pleroma', 'quote'])).toBe(undefined); }); + + it('normalizes GoToSocial status', () => { + const status = fromJS(require('soapbox/__fixtures__/gotosocial-status.json')); + const result = normalizeStatus(status); + + // Adds missing fields + const missing = { + in_reply_to_account_id: null, + in_reply_to_id: null, + reblog: null, + pinned: false, + quote: null, + }; + + expect(result.toJS()).toMatchObject(missing); + }); + + it('normalizes Friendica status', () => { + const status = fromJS(require('soapbox/__fixtures__/friendica-status.json')); + const result = normalizeStatus(status); + + // Adds missing fields + const missing = { + pinned: false, + quote: null, + }; + + expect(result.toJS()).toMatchObject(missing); + }); });