parent
07aaa427a6
commit
7054a5e9ac
@ -0,0 +1,35 @@
|
||||
{
|
||||
"id": "66768",
|
||||
"username": "alex",
|
||||
"acct": "alex",
|
||||
"display_name": "",
|
||||
"locked": false,
|
||||
"bot": false,
|
||||
"cat": false,
|
||||
"discoverable": false,
|
||||
"group": false,
|
||||
"created_at": "2020-01-27T00:00:00.000Z",
|
||||
"note": "<p></p>",
|
||||
"url": "https://fedibird.com/@alex",
|
||||
"avatar": "https://fedibird.com/avatars/original/missing.png",
|
||||
"avatar_static": "https://fedibird.com/avatars/original/missing.png",
|
||||
"header": "https://fedibird.com/headers/original/missing.png",
|
||||
"header_static": "https://fedibird.com/headers/original/missing.png",
|
||||
"followers_count": 1,
|
||||
"following_count": 1,
|
||||
"subscribing_count": 0,
|
||||
"statuses_count": 5,
|
||||
"last_status_at": "2022-02-20",
|
||||
"emojis": [],
|
||||
"fields": [],
|
||||
"other_settings": {
|
||||
"birthday": "1993-07-03",
|
||||
"location": "Texas, USA",
|
||||
"noindex": false,
|
||||
"hide_network": false,
|
||||
"hide_statuses_count": false,
|
||||
"hide_following_count": false,
|
||||
"hide_followers_count": false,
|
||||
"enable_reaction": true
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
import { normalizeAccount } from '../account';
|
||||
|
||||
describe('normalizeAccount()', () => {
|
||||
it('normalizes Fedibird birthday', () => {
|
||||
const account = fromJS(require('soapbox/__fixtures__/fedibird-account.json'));
|
||||
const result = normalizeAccount(account);
|
||||
|
||||
expect(result.get('birthday')).toEqual('1993-07-03');
|
||||
});
|
||||
|
||||
it('normalizes Pleroma birthday', () => {
|
||||
const account = fromJS(require('soapbox/__fixtures__/pleroma-account.json'));
|
||||
const result = normalizeAccount(account);
|
||||
|
||||
expect(result.get('birthday')).toEqual('1993-07-03');
|
||||
});
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
export const normalizeAccount = account => {
|
||||
const birthday = [
|
||||
account.getIn(['pleroma', 'birthday']),
|
||||
account.getIn(['other_settings', 'birthday']),
|
||||
].find(Boolean);
|
||||
|
||||
return account.set('birthday', birthday);
|
||||
};
|
Loading…
Reference in new issue