utils/timelines test: remove fromJS calls

update-emoji-mart
Alex Gleason 2022-07-06 11:32:14 -05:00
rodzic e1807c9250
commit a509428f97
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 11 dodań i 11 usunięć

Wyświetl plik

@ -7,67 +7,67 @@ import { shouldFilter } from '../timelines';
describe('shouldFilter', () => {
it('returns false under normal circumstances', () => {
const columnSettings = fromJS({});
const status = normalizeStatus(fromJS({}));
const status = normalizeStatus({});
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('reblog: returns true when `shows.reblog == false`', () => {
const columnSettings = fromJS({ shows: { reblog: false } });
const status = normalizeStatus(fromJS({ reblog: {} }));
const status = normalizeStatus({ reblog: {} });
expect(shouldFilter(status, columnSettings)).toBe(true);
});
it('reblog: returns false when `shows.reblog == true`', () => {
const columnSettings = fromJS({ shows: { reblog: true } });
const status = normalizeStatus(fromJS({ reblog: {} }));
const status = normalizeStatus({ reblog: {} });
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('reply: returns true when `shows.reply == false`', () => {
const columnSettings = fromJS({ shows: { reply: false } });
const status = normalizeStatus(fromJS({ in_reply_to_id: '1234' }));
const status = normalizeStatus({ in_reply_to_id: '1234' });
expect(shouldFilter(status, columnSettings)).toBe(true);
});
it('reply: returns false when `shows.reply == true`', () => {
const columnSettings = fromJS({ shows: { reply: true } });
const status = normalizeStatus(fromJS({ in_reply_to_id: '1234' }));
const status = normalizeStatus({ in_reply_to_id: '1234' });
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('direct: returns true when `shows.direct == false`', () => {
const columnSettings = fromJS({ shows: { direct: false } });
const status = normalizeStatus(fromJS({ visibility: 'direct' }));
const status = normalizeStatus({ visibility: 'direct' });
expect(shouldFilter(status, columnSettings)).toBe(true);
});
it('direct: returns false when `shows.direct == true`', () => {
const columnSettings = fromJS({ shows: { direct: true } });
const status = normalizeStatus(fromJS({ visibility: 'direct' }));
const status = normalizeStatus({ visibility: 'direct' });
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('direct: returns false for a public post when `shows.direct == false`', () => {
const columnSettings = fromJS({ shows: { direct: false } });
const status = normalizeStatus(fromJS({ visibility: 'public' }));
const status = normalizeStatus({ visibility: 'public' });
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('multiple settings', () => {
const columnSettings = fromJS({ shows: { reblog: false, reply: false, direct: false } });
const status = normalizeStatus(fromJS({ reblog: null, in_reply_to_id: null, visibility: 'direct' }));
const status = normalizeStatus({ reblog: null, in_reply_to_id: null, visibility: 'direct' });
expect(shouldFilter(status, columnSettings)).toBe(true);
});
it('multiple settings', () => {
const columnSettings = fromJS({ shows: { reblog: false, reply: true, direct: false } });
const status = normalizeStatus(fromJS({ reblog: null, in_reply_to_id: '1234', visibility: 'public' }));
const status = normalizeStatus({ reblog: null, in_reply_to_id: '1234', visibility: 'public' });
expect(shouldFilter(status, columnSettings)).toBe(false);
});
it('multiple settings', () => {
const columnSettings = fromJS({ shows: { reblog: true, reply: false, direct: true } });
const status = normalizeStatus(fromJS({ reblog: {}, in_reply_to_id: '1234', visibility: 'direct' }));
const status = normalizeStatus({ reblog: {}, in_reply_to_id: '1234', visibility: 'direct' });
expect(shouldFilter(status, columnSettings)).toBe(true);
});
});