bigbuffet-rw/app/soapbox/normalizers/__tests__/mention-test.js
2022-03-16 21:47:58 -05:00

23 lines
658 B
JavaScript

import { Record as ImmutableRecord } from 'immutable';
import { normalizeMention } from '../mention';
describe('normalizeMention()', () => {
it('adds base fields', () => {
const account = {};
const result = normalizeMention(account);
expect(ImmutableRecord.isRecord(result)).toBe(true);
expect(result.id).toEqual('');
expect(result.acct).toEqual('');
expect(result.username).toEqual('');
expect(result.url).toEqual('');
});
it('infers username from acct', () => {
const account = { acct: 'alex@gleasonator.com' };
const result = normalizeMention(account);
expect(result.username).toEqual('alex');
});
});