further edit of compose-test.js
This commit is contained in:
parent
0641b29e2a
commit
a9d9c44a72
1 changed files with 64 additions and 54 deletions
|
@ -7,6 +7,7 @@ import * as actions from 'soapbox/actions/compose';
|
|||
import { STORE_HYDRATE } from 'soapbox/actions/store';
|
||||
import { REDRAFT } from 'soapbox/actions/statuses';
|
||||
import { TIMELINE_DELETE } from 'soapbox/actions/timelines';
|
||||
import uuid from 'soapbox/uuid';
|
||||
|
||||
describe('compose reducer', () => {
|
||||
it('returns the initial state by default', () => {
|
||||
|
@ -153,30 +154,39 @@ describe('compose reducer', () => {
|
|||
});
|
||||
});
|
||||
|
||||
// it('should handle COMPOSE_UNMOUNT', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UNMOUNT,
|
||||
// };
|
||||
// expect(reducer(state, action).toJS()).toMatchObject({
|
||||
// default_privacy: 'unlisted',
|
||||
// privacy: 'public',
|
||||
// });
|
||||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SENSITIVITY_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SENSITIVITY_CHANGE,
|
||||
// };
|
||||
// expect(reducer(state, action).toJS()).toMatchObject({
|
||||
// default_privacy: 'unlisted',
|
||||
// privacy: 'public',
|
||||
// });
|
||||
// });
|
||||
//
|
||||
it('should handle COMPOSE_UNMOUNT', () => {
|
||||
const state = ImmutableMap({ mounted: 1, is_composing: true });
|
||||
const action = {
|
||||
type: actions.COMPOSE_UNMOUNT,
|
||||
};
|
||||
expect(reducer(state, action).toJS()).toMatchObject({
|
||||
mounted: 0,
|
||||
is_composing: false,
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle COMPOSE_SENSITIVITY_CHANGE, with sensitive icon click to toggle, with spoiler active', () => {
|
||||
const state = ImmutableMap({ spoiler: true, sensitive: true });
|
||||
const action = {
|
||||
type: actions.COMPOSE_SENSITIVITY_CHANGE,
|
||||
};
|
||||
expect(reducer(state, action).toJS()).toMatchObject({
|
||||
sensitive: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('should handle COMPOSE_SENSITIVITY_CHANGE, with sensitive icon click to toggle, with spoiler inactive', () => {
|
||||
const state = ImmutableMap({ spoiler: false, sensitive: true });
|
||||
const action = {
|
||||
type: actions.COMPOSE_SENSITIVITY_CHANGE,
|
||||
};
|
||||
expect(reducer(state, action).toJS()).toMatchObject({
|
||||
sensitive: false,
|
||||
});
|
||||
});
|
||||
|
||||
// it('should handle COMPOSE_SPOILERNESS_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SPOILERNESS_CHANGE,
|
||||
// };
|
||||
|
@ -187,7 +197,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SPOILER_TEXT_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SPOILER_TEXT_CHANGE,
|
||||
// };
|
||||
|
@ -198,7 +208,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_VISIBILITY_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_VISIBILITY_CHANGE,
|
||||
// };
|
||||
|
@ -209,7 +219,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_CHANGE,
|
||||
// };
|
||||
|
@ -220,7 +230,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_COMPOSING_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_COMPOSING_CHANGE,
|
||||
// };
|
||||
|
@ -231,7 +241,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUBMIT_REQUEST', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUBMIT_REQUEST,
|
||||
// };
|
||||
|
@ -242,7 +252,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_CHANGE_REQUEST', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_CHANGE_REQUEST,
|
||||
// };
|
||||
|
@ -253,7 +263,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUBMIT_SUCCESS', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUBMIT_SUCCESS,
|
||||
// };
|
||||
|
@ -264,7 +274,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUBMIT_FAIL', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUBMIT_FAIL,
|
||||
// };
|
||||
|
@ -275,7 +285,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_CHANGE_FAIL', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_CHANGE_FAIL,
|
||||
// };
|
||||
|
@ -286,7 +296,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_REQUEST', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_REQUEST,
|
||||
// };
|
||||
|
@ -297,7 +307,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_SUCCESS', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_SUCCESS,
|
||||
// };
|
||||
|
@ -308,7 +318,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_FAIL', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_FAIL,
|
||||
// };
|
||||
|
@ -319,7 +329,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_UNDO', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_UNDO,
|
||||
// };
|
||||
|
@ -330,7 +340,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_PROGRESS', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_PROGRESS,
|
||||
// };
|
||||
|
@ -341,7 +351,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_MENTION', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_MENTION,
|
||||
// };
|
||||
|
@ -352,7 +362,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_DIRECT', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_DIRECT,
|
||||
// };
|
||||
|
@ -363,7 +373,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUGGESTIONS_CLEAR', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUGGESTIONS_CLEAR,
|
||||
// };
|
||||
|
@ -374,7 +384,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUGGESTIONS_READY', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUGGESTIONS_READY,
|
||||
// };
|
||||
|
@ -385,7 +395,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUGGESTION_SELECT', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUGGESTION_SELECT,
|
||||
// };
|
||||
|
@ -396,7 +406,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_SUGGESTION_TAGS_UPDATE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_SUGGESTION_TAGS_UPDATE,
|
||||
// };
|
||||
|
@ -407,7 +417,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_TAG_HISTORY_UPDATE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_TAG_HISTORY_UPDATE,
|
||||
// };
|
||||
|
@ -418,7 +428,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle TIMELINE_DELETE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: TIMELINE_DELETE,
|
||||
// };
|
||||
|
@ -429,7 +439,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_EMOJI_INSERT', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_EMOJI_INSERT,
|
||||
// };
|
||||
|
@ -440,7 +450,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_UPLOAD_CHANGE_SUCCESS', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_UPLOAD_CHANGE_SUCCESS,
|
||||
// };
|
||||
|
@ -451,7 +461,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle REDRAFT', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: REDRAFT,
|
||||
// };
|
||||
|
@ -462,7 +472,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_ADD', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_ADD,
|
||||
// };
|
||||
|
@ -473,7 +483,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_REMOVE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_REMOVE,
|
||||
// };
|
||||
|
@ -484,7 +494,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_OPTION_ADD', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_OPTION_ADD,
|
||||
// };
|
||||
|
@ -495,7 +505,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_OPTION_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_OPTION_CHANGE,
|
||||
// };
|
||||
|
@ -506,7 +516,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_OPTION_REMOVE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_OPTION_REMOVE,
|
||||
// };
|
||||
|
@ -517,7 +527,7 @@ describe('compose reducer', () => {
|
|||
// });
|
||||
//
|
||||
// it('should handle COMPOSE_POLL_SETTINGS_CHANGE', () => {
|
||||
// const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'});
|
||||
// const state = ImmutableMap({ default_privacy: 'public' });
|
||||
// const action = {
|
||||
// type: actions.COMPOSE_POLL_SETTINGS_CHANGE,
|
||||
// };
|
||||
|
|
Loading…
Reference in a new issue