bigbuffet-rw/app/soapbox/reducers/__tests__/accounts.test.ts
marcin mikołajczak 5fec879148 Fix mutes test, prefer TypeScript for tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2022-06-12 16:30:48 +02:00

29 lines
1,016 B
TypeScript

import { Map as ImmutableMap, Record as ImmutableRecord } from 'immutable';
import { ACCOUNT_IMPORT } from 'soapbox/actions/importer';
import reducer from '../accounts';
describe('accounts reducer', () => {
it('should return the initial state', () => {
expect(reducer(undefined, {} as any)).toEqual(ImmutableMap());
});
describe('ACCOUNT_IMPORT', () => {
it('parses the account as a Record', () => {
const account = require('soapbox/__fixtures__/pleroma-account.json');
const action = { type: ACCOUNT_IMPORT, account };
const result = reducer(undefined, action).get('9v5bmRalQvjOy0ECcC');
expect(ImmutableRecord.isRecord(result)).toBe(true);
});
it('minifies a moved account', () => {
const account = require('soapbox/__fixtures__/account-moved.json');
const action = { type: ACCOUNT_IMPORT, account };
const result = reducer(undefined, action).get('106801667066418367');
expect(result.moved).toBe('107945464165013501');
});
});
});