Tests: Boilerplate all reducers
This commit is contained in:
parent
0c1eeb9efa
commit
f4c12c6986
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../accounts';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('accounts reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../accounts_counters';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('accounts_counters reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../alerts';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('alerts reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableList());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,30 @@
|
||||||
|
import reducer from '../compose';
|
||||||
|
|
||||||
|
describe('compose reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {}).toJS()).toMatchObject({
|
||||||
|
mounted: 0,
|
||||||
|
sensitive: false,
|
||||||
|
spoiler: false,
|
||||||
|
spoiler_text: '',
|
||||||
|
privacy: null,
|
||||||
|
text: '',
|
||||||
|
focusDate: null,
|
||||||
|
caretPosition: null,
|
||||||
|
in_reply_to: null,
|
||||||
|
is_composing: false,
|
||||||
|
is_submitting: false,
|
||||||
|
is_changing_upload: false,
|
||||||
|
is_uploading: false,
|
||||||
|
progress: 0,
|
||||||
|
media_attachments: [],
|
||||||
|
poll: null,
|
||||||
|
suggestion_token: null,
|
||||||
|
suggestions: [],
|
||||||
|
default_privacy: 'public',
|
||||||
|
default_sensitive: false,
|
||||||
|
idempotencyKey: null,
|
||||||
|
tagHistory: [],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import reducer from '../contexts';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('contexts reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
inReplyTos: ImmutableMap(),
|
||||||
|
replies: ImmutableMap(),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
import reducer from '../conversations';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('conversations reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
isLoading: false,
|
||||||
|
hasMore: true,
|
||||||
|
mounted: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../custom_emojis';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('custom_emojis reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableList());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import reducer from '../domain_lists';
|
||||||
|
import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable';
|
||||||
|
|
||||||
|
describe('domain_lists reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
blocks: ImmutableMap({
|
||||||
|
items: ImmutableOrderedSet(),
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import reducer from '../dropdown_menu';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('dropdown_menu reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
openId: null,
|
||||||
|
placement: null,
|
||||||
|
keyboard: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../filters';
|
||||||
|
import { List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('filters reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableList());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,15 @@
|
||||||
|
import reducer from '../group_editor';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('group_editor reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
groupId: null,
|
||||||
|
isSubmitting: false,
|
||||||
|
isChanged: false,
|
||||||
|
title: '',
|
||||||
|
description: '',
|
||||||
|
coverImage: null,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,12 @@
|
||||||
|
import reducer from '../group_lists';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('group_lists reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
featured: ImmutableList(),
|
||||||
|
member: ImmutableList(),
|
||||||
|
admin: ImmutableList(),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../group_relationships';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('group_relationships reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../groups';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('groups reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../height_cache';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('height_cache reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../identity_proofs';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('identity_proofs reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,16 @@
|
||||||
|
import reducer from '../instance';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('instance reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
max_toot_chars: 500,
|
||||||
|
poll_limits: ImmutableMap({
|
||||||
|
max_expiration: 2629746,
|
||||||
|
max_option_chars: 25,
|
||||||
|
max_options: 4,
|
||||||
|
min_expiration: 300,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,16 @@
|
||||||
|
import reducer from '../list_adder';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('list_adder reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
accountId: null,
|
||||||
|
|
||||||
|
lists: ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
loaded: false,
|
||||||
|
isLoading: false,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,24 @@
|
||||||
|
import reducer from '../list_editor';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('list_editor reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
listId: null,
|
||||||
|
isSubmitting: false,
|
||||||
|
isChanged: false,
|
||||||
|
title: '',
|
||||||
|
|
||||||
|
accounts: ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
loaded: false,
|
||||||
|
isLoading: false,
|
||||||
|
}),
|
||||||
|
|
||||||
|
suggestions: ImmutableMap({
|
||||||
|
value: '',
|
||||||
|
items: ImmutableList(),
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../lists';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('lists reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
import reducer from '../me';
|
||||||
|
|
||||||
|
describe('me reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(null);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,27 @@
|
||||||
|
import reducer from '../media_attachments';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('media_attachments reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
accept_content_types: ImmutableList([
|
||||||
|
'.jpg',
|
||||||
|
'.jpeg',
|
||||||
|
'.png',
|
||||||
|
'.gif',
|
||||||
|
'.webp',
|
||||||
|
'.webm',
|
||||||
|
'.mp4',
|
||||||
|
'.m4v',
|
||||||
|
'.mov',
|
||||||
|
'image/jpeg',
|
||||||
|
'image/png',
|
||||||
|
'image/gif',
|
||||||
|
'image/webp',
|
||||||
|
'video/webm',
|
||||||
|
'video/mp4',
|
||||||
|
'video/quicktime',
|
||||||
|
]),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../meta';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('meta reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,10 @@
|
||||||
|
import reducer from '../modal';
|
||||||
|
|
||||||
|
describe('modal reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual({
|
||||||
|
modalType: null,
|
||||||
|
modalProps: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
import reducer from '../mutes';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('mutes reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
new: ImmutableMap({
|
||||||
|
isSubmitting: false,
|
||||||
|
account: null,
|
||||||
|
notifications: true,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
import reducer from '../notifications';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('notifications reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
hasMore: true,
|
||||||
|
top: false,
|
||||||
|
unread: 0,
|
||||||
|
isLoading: false,
|
||||||
|
queuedNotifications: ImmutableList(),
|
||||||
|
totalQueuedNotificationsCount: 0,
|
||||||
|
lastRead: -1,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../patron';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('patron reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../polls';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('polls reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,19 @@
|
||||||
|
import reducer from '../push_notifications';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('push_notifications reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
subscription: null,
|
||||||
|
alerts: new ImmutableMap({
|
||||||
|
follow: false,
|
||||||
|
favourite: false,
|
||||||
|
reblog: false,
|
||||||
|
mention: false,
|
||||||
|
poll: false,
|
||||||
|
}),
|
||||||
|
isSubscribed: false,
|
||||||
|
browserSupport: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../relationships';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('relationships reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,17 @@
|
||||||
|
import reducer from '../reports';
|
||||||
|
import { Map as ImmutableMap, Set as ImmutableSet } from 'immutable';
|
||||||
|
|
||||||
|
describe('reports reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
new: ImmutableMap({
|
||||||
|
isSubmitting: false,
|
||||||
|
account_id: null,
|
||||||
|
status_ids: ImmutableSet(),
|
||||||
|
comment: '',
|
||||||
|
forward: false,
|
||||||
|
block: false,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,13 @@
|
||||||
|
import reducer from '../search';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('search reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
value: '',
|
||||||
|
submitted: false,
|
||||||
|
hidden: false,
|
||||||
|
results: ImmutableMap(),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,10 @@
|
||||||
|
import reducer from '../settings';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('settings reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
saved: true,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,7 @@
|
||||||
|
import reducer from '../sidebar';
|
||||||
|
|
||||||
|
describe('sidebar reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual({});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../soapbox';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('soapbox reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,19 @@
|
||||||
|
import reducer from '../status_lists';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('status_lists reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
favourites: ImmutableMap({
|
||||||
|
next: null,
|
||||||
|
loaded: false,
|
||||||
|
items: ImmutableList(),
|
||||||
|
}),
|
||||||
|
pins: ImmutableMap({
|
||||||
|
next: null,
|
||||||
|
loaded: false,
|
||||||
|
items: ImmutableList(),
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../statuses';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('statuses reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import reducer from '../suggestions';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('suggestions reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
isLoading: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,8 @@
|
||||||
|
import reducer from '../timelines';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('timelines reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap());
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
import reducer from '../trends';
|
||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
|
||||||
|
describe('trends reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
isLoading: false,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,18 @@
|
||||||
|
import reducer from '../user_lists';
|
||||||
|
import { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
describe('user_lists reducer', () => {
|
||||||
|
it('should return the initial state', () => {
|
||||||
|
expect(reducer(undefined, {})).toEqual(ImmutableMap({
|
||||||
|
followers: ImmutableMap(),
|
||||||
|
following: ImmutableMap(),
|
||||||
|
reblogged_by: ImmutableMap(),
|
||||||
|
favourited_by: ImmutableMap(),
|
||||||
|
follow_requests: ImmutableMap(),
|
||||||
|
blocks: ImmutableMap(),
|
||||||
|
mutes: ImmutableMap(),
|
||||||
|
groups: ImmutableMap(),
|
||||||
|
groups_removed_accounts: ImmutableMap(),
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue