normalizeInstance(): add fixtures and tests for Fedibird, Mitra
This commit is contained in:
parent
331b239cc9
commit
fe6ffc9bc5
3 changed files with 218 additions and 0 deletions
185
app/soapbox/__fixtures__/fedibird-instance.json
Normal file
185
app/soapbox/__fixtures__/fedibird-instance.json
Normal file
|
@ -0,0 +1,185 @@
|
|||
{
|
||||
"uri": "fedibird.com",
|
||||
"title": "Fedibird",
|
||||
"short_description": "多くの独自機能を備えた、連合志向の汎用Mastodonサーバです。Fediverseの活動拠点としてご利用ください。",
|
||||
"description": "多くの独自機能を備えた、連合志向の汎用Mastodonサーバです。Fediverseの活動拠点としてご利用ください。",
|
||||
"email": "support@fedibird.com",
|
||||
"version": "3.4.1",
|
||||
"urls": {
|
||||
"streaming_api": "wss://fedibird.com"
|
||||
},
|
||||
"stats": {
|
||||
"user_count": 1964,
|
||||
"status_count": 4590304,
|
||||
"domain_count": 9024
|
||||
},
|
||||
"thumbnail": "https://s3.fedibird.com/site_uploads/files/000/000/001/original/fedibird_hero_image.png",
|
||||
"languages": [
|
||||
"ja"
|
||||
],
|
||||
"registrations": true,
|
||||
"approval_required": false,
|
||||
"invites_enabled": true,
|
||||
"configuration": {
|
||||
"statuses": {
|
||||
"max_characters": 500,
|
||||
"max_media_attachments": 4,
|
||||
"characters_reserved_per_url": 23,
|
||||
"min_expiration": 60,
|
||||
"max_expiration": 37152000,
|
||||
"supported_expires_actions": [
|
||||
"delete",
|
||||
"mark"
|
||||
]
|
||||
},
|
||||
"media_attachments": {
|
||||
"supported_mime_types": [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/gif",
|
||||
"image/webp",
|
||||
"image/heif",
|
||||
"image/heic",
|
||||
"video/webm",
|
||||
"video/mp4",
|
||||
"video/quicktime",
|
||||
"video/ogg",
|
||||
"audio/wave",
|
||||
"audio/wav",
|
||||
"audio/x-wav",
|
||||
"audio/x-pn-wave",
|
||||
"audio/ogg",
|
||||
"audio/mpeg",
|
||||
"audio/mp3",
|
||||
"audio/webm",
|
||||
"audio/flac",
|
||||
"audio/aac",
|
||||
"audio/m4a",
|
||||
"audio/x-m4a",
|
||||
"audio/mp4",
|
||||
"audio/3gpp",
|
||||
"video/x-ms-asf"
|
||||
],
|
||||
"image_size_limit": 10485760,
|
||||
"image_matrix_limit": 16777216,
|
||||
"video_size_limit": 41943040,
|
||||
"video_frame_rate_limit": 60,
|
||||
"video_matrix_limit": 2304000
|
||||
},
|
||||
"polls": {
|
||||
"max_options": 4,
|
||||
"max_characters_per_option": 50,
|
||||
"min_expiration": 300,
|
||||
"max_expiration": 2629746
|
||||
},
|
||||
"emoji_reactions": {
|
||||
"max_reactions": 20
|
||||
}
|
||||
},
|
||||
"feature_quote": true,
|
||||
"fedibird_capabilities": [
|
||||
"favourite_hashtag",
|
||||
"favourite_domain",
|
||||
"favourite_list",
|
||||
"status_expire",
|
||||
"follow_no_delivery",
|
||||
"follow_hashtag",
|
||||
"subscribe_account",
|
||||
"subscribe_domain",
|
||||
"subscribe_keyword",
|
||||
"timeline_home_visibility",
|
||||
"timeline_no_local",
|
||||
"timeline_domain",
|
||||
"timeline_group",
|
||||
"timeline_group_directory",
|
||||
"visibility_mutual",
|
||||
"visibility_limited",
|
||||
"emoji_reaction",
|
||||
"misskey_birthday",
|
||||
"misskey_location"
|
||||
],
|
||||
"contact_account": {
|
||||
"id": "1",
|
||||
"username": "noellabo",
|
||||
"acct": "noellabo",
|
||||
"display_name": "のえる",
|
||||
"locked": false,
|
||||
"bot": false,
|
||||
"cat": false,
|
||||
"discoverable": true,
|
||||
"group": false,
|
||||
"created_at": "2019-08-15T00:00:00.000Z",
|
||||
"note": "<p>主に、Fediverseへの関心に基づいた投稿を行うアカウントです。DTP・印刷に関する話をしたり、同人の話をしたり、カレーをブーストしたりします。</p><p>Mastodonサーバ『Fedibird』の管理者アカウントでもあります。ご連絡は当アカウントへ、サーバインフォメーションについては <a href=\"https://fedibird.com/about/more\" rel=\"nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">fedibird.com/about/more</span><span class=\"invisible\"></span></a> と <span class=\"h-card\"><a href=\"https://fedibird.com/@info\" class=\"u-url mention\">@<span>info</span></a></span> を参照してください。</p>",
|
||||
"url": "https://fedibird.com/@noellabo",
|
||||
"avatar": "https://s3.fedibird.com/accounts/avatars/000/000/001/original/6ef3b7f18f726755.png",
|
||||
"avatar_static": "https://s3.fedibird.com/accounts/avatars/000/000/001/original/6ef3b7f18f726755.png",
|
||||
"header": "https://s3.fedibird.com/accounts/headers/000/000/001/original/6a5a51722c094835.jpg",
|
||||
"header_static": "https://s3.fedibird.com/accounts/headers/000/000/001/original/6a5a51722c094835.jpg",
|
||||
"followers_count": 1560,
|
||||
"following_count": 758,
|
||||
"subscribing_count": 121,
|
||||
"statuses_count": 61325,
|
||||
"last_status_at": "2022-02-24",
|
||||
"emojis": [
|
||||
{
|
||||
"shortcode": "liberapay",
|
||||
"url": "https://s3.fedibird.com/custom_emojis/images/000/025/634/original/5b8620742973f844.png",
|
||||
"static_url": "https://s3.fedibird.com/custom_emojis/images/000/025/634/static/5b8620742973f844.png",
|
||||
"visible_in_picker": true
|
||||
},
|
||||
{
|
||||
"shortcode": "mastodon",
|
||||
"url": "https://s3.fedibird.com/custom_emojis/images/000/008/396/original/1317b6f8efcf8318.png",
|
||||
"static_url": "https://s3.fedibird.com/custom_emojis/images/000/008/396/static/1317b6f8efcf8318.png",
|
||||
"visible_in_picker": true
|
||||
}
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"name": ":liberapay: Liberapay",
|
||||
"value": "<a href=\"https://liberapay.com/noellabo\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">liberapay.com/noellabo</span><span class=\"invisible\"></span></a>",
|
||||
"verified_at": "2020-10-22T03:04:43.206+00:00"
|
||||
},
|
||||
{
|
||||
"name": ":mastodon: DTP-Mstdn.jp",
|
||||
"value": "<a class=\"account-url-link\" data-account-acct=\"noellabo@dtp-mstdn.jp\" data-account-actor-type=\"Person\" data-account-id=\"55\" href=\"https://dtp-mstdn.jp/@noellabo\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">dtp-mstdn.jp/@noellabo</span><span class=\"invisible\"></span></a>",
|
||||
"verified_at": "2020-05-23T00:14:02.232+00:00"
|
||||
},
|
||||
{
|
||||
"name": "別宅",
|
||||
"value": "<a class=\"account-url-link\" data-account-acct=\"noellabo@gorone.xyz\" data-account-actor-type=\"Person\" data-account-id=\"14504\" href=\"https://gorone.xyz/@noellabo\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"\">gorone.xyz/@noellabo</span><span class=\"invisible\"></span></a>",
|
||||
"verified_at": "2021-08-11T07:48:53.479+00:00"
|
||||
},
|
||||
{
|
||||
"name": "bluesky community",
|
||||
"value": "<a class=\"account-url-link\" data-account-acct=\"noellabo@mastodon.blueskycommunity.net\" data-account-actor-type=\"Person\" data-account-id=\"107267866207603606\" href=\"https://mastodon.blueskycommunity.net/@noellabo\" rel=\"me nofollow noopener noreferrer\" target=\"_blank\"><span class=\"invisible\">https://</span><span class=\"ellipsis\">mastodon.blueskycommunity.net/</span><span class=\"invisible\">@noellabo</span></a>",
|
||||
"verified_at": "2021-11-13T04:28:30.593+00:00"
|
||||
}
|
||||
],
|
||||
"other_settings": {
|
||||
"birthday": null,
|
||||
"location": "埼玉県",
|
||||
"cat_ears_color": "#d5c5c0",
|
||||
"noindex": false,
|
||||
"hide_network": false,
|
||||
"hide_statuses_count": false,
|
||||
"hide_following_count": false,
|
||||
"hide_followers_count": false,
|
||||
"enable_reaction": true
|
||||
}
|
||||
},
|
||||
"rules": [
|
||||
{
|
||||
"id": "2",
|
||||
"text": "日本の法律と社会規範に従った行動を心がけてください"
|
||||
},
|
||||
{
|
||||
"id": "3",
|
||||
"text": "不快や脅威に対してはブロック・ミュート・フィルターで距離をとってください"
|
||||
},
|
||||
{
|
||||
"id": "1",
|
||||
"text": "投稿する際は、適切な公開範囲・CW・閲覧注意を使用してください"
|
||||
}
|
||||
]
|
||||
}
|
13
app/soapbox/__fixtures__/mitra-instance.json
Normal file
13
app/soapbox/__fixtures__/mitra-instance.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"uri": "mitra.social",
|
||||
"title": "Mitra",
|
||||
"short_description": "Federated social network with smart contracts",
|
||||
"description": "This is an instance of [Mitra](https://codeberg.org/silverpill/mitra), federated social network built on [ActivityPub](https://activitypub.rocks/) protocol.\nRegistration is invitation-only.\nAdmin:\n - [@silverpill@mitra.social](https://mitra.social/profile/dd4ebc18-269d-4c7b-a310-03d29c6ab551)\n - Matrix: @silverpill:poa.st\n",
|
||||
"version": "3.0.0 (compatible; Mitra 0.4.0)",
|
||||
"registrations": false,
|
||||
"login_message": "Sign this message to log in to https://mitra.social. Do not sign this message on other sites!",
|
||||
"post_character_limit": 5000,
|
||||
"blockchain_explorer_url": null,
|
||||
"blockchain_contract_address": null,
|
||||
"ipfs_gateway_url": "https://ipfs.mitra.social"
|
||||
}
|
|
@ -98,4 +98,24 @@ describe('normalizeInstance()', () => {
|
|||
const result = normalizeInstance(instance);
|
||||
expect(result.toJS()).toMatchObject(expected);
|
||||
});
|
||||
|
||||
it('normalizes Fedibird instance', () => {
|
||||
const instance = fromJS(require('soapbox/__fixtures__/fedibird-instance.json'));
|
||||
const result = normalizeInstance(instance);
|
||||
|
||||
// Sets description_limit
|
||||
expect(result.get('description_limit')).toEqual(1500);
|
||||
|
||||
// But otherwise, it's the same
|
||||
expect(result.delete('description_limit')).toEqual(instance);
|
||||
});
|
||||
|
||||
it('normalizes Mitra instance', () => {
|
||||
const instance = fromJS(require('soapbox/__fixtures__/mitra-instance.json'));
|
||||
const result = normalizeInstance(instance);
|
||||
|
||||
// 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