normalizeInstance(): add tests for GoToSocial and Friendica
This commit is contained in:
parent
fe6ffc9bc5
commit
0c962ee198
2 changed files with 72 additions and 0 deletions
46
app/soapbox/__fixtures__/friendica-instance.json
Normal file
46
app/soapbox/__fixtures__/friendica-instance.json
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"uri": "https://ica.mkljczk.pl",
|
||||||
|
"title": "Friendica Social Network",
|
||||||
|
"short_description": "",
|
||||||
|
"description": "",
|
||||||
|
"email": "me@mkljczk.pl",
|
||||||
|
"version": "2022.05-dev",
|
||||||
|
"urls": null,
|
||||||
|
"stats": {
|
||||||
|
"user_count": 0,
|
||||||
|
"status_count": 0,
|
||||||
|
"domain_count": 0
|
||||||
|
},
|
||||||
|
"thumbnail": "https://ica.mkljczk.plimages/friendica-32.png",
|
||||||
|
"languages": [
|
||||||
|
"pl"
|
||||||
|
],
|
||||||
|
"max_toot_chars": 200000,
|
||||||
|
"registrations": true,
|
||||||
|
"approval_required": false,
|
||||||
|
"invites_enabled": false,
|
||||||
|
"contact_account": {
|
||||||
|
"id": "2",
|
||||||
|
"username": "nofriend",
|
||||||
|
"acct": "nofriend",
|
||||||
|
"display_name": "marcin mikołajczak",
|
||||||
|
"locked": true,
|
||||||
|
"bot": false,
|
||||||
|
"discoverable": true,
|
||||||
|
"group": false,
|
||||||
|
"created_at": "2022-02-19T14:51:00.000Z",
|
||||||
|
"note": "",
|
||||||
|
"url": "https://ica.mkljczk.pl/profile/nofriend",
|
||||||
|
"avatar": "https://ica.mkljczk.pl/photo/contact/300/68a16c11-1262-1103-d40b-806159848009?ts=1645292106",
|
||||||
|
"avatar_static": "https://ica.mkljczk.pl/photo/contact/300/68a16c11-1262-1103-d40b-806159848009?ts=1645292106",
|
||||||
|
"header": "https://ica.mkljczk.pl/photo/header/68a16c11-1262-1103-d40b-806159848009?ts=1645292106",
|
||||||
|
"header_static": "https://ica.mkljczk.pl/photo/header/68a16c11-1262-1103-d40b-806159848009?ts=1645292106",
|
||||||
|
"followers_count": 0,
|
||||||
|
"following_count": 1,
|
||||||
|
"statuses_count": 0,
|
||||||
|
"last_status_at": "2022-02-20",
|
||||||
|
"emojis": [],
|
||||||
|
"fields": []
|
||||||
|
},
|
||||||
|
"rules": []
|
||||||
|
}
|
|
@ -118,4 +118,30 @@ describe('normalizeInstance()', () => {
|
||||||
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
|
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
|
||||||
expect(result.get('description_limit')).toBe(1500);
|
expect(result.get('description_limit')).toBe(1500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('normalizes GoToSocial instance', () => {
|
||||||
|
const instance = fromJS(require('soapbox/__fixtures__/gotosocial-instance.json'));
|
||||||
|
const result = normalizeInstance(instance);
|
||||||
|
|
||||||
|
// Normalizes max_toot_chars
|
||||||
|
expect(result.getIn(['configuration', 'statuses', 'max_characters'])).toEqual(5000);
|
||||||
|
expect(result.has('max_toot_chars')).toBe(false);
|
||||||
|
|
||||||
|
// Adds configuration and description_limit
|
||||||
|
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
|
||||||
|
expect(result.get('description_limit')).toBe(1500);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('normalizes Friendica instance', () => {
|
||||||
|
const instance = fromJS(require('soapbox/__fixtures__/friendica-instance.json'));
|
||||||
|
const result = normalizeInstance(instance);
|
||||||
|
|
||||||
|
// Normalizes max_toot_chars
|
||||||
|
expect(result.getIn(['configuration', 'statuses', 'max_characters'])).toEqual(200000);
|
||||||
|
expect(result.has('max_toot_chars')).toBe(false);
|
||||||
|
|
||||||
|
// Adds configuration and description_limit
|
||||||
|
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
|
||||||
|
expect(result.get('description_limit')).toBe(1500);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue