further edit of compose-test.js

tl-language-filters
crockwave 2020-07-01 16:40:15 -05:00
rodzic 0641b29e2a
commit a9d9c44a72
1 zmienionych plików z 64 dodań i 54 usunięć

Wyświetl plik

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