diff --git a/app/soapbox/reducers/__tests__/compose-test.js b/app/soapbox/reducers/__tests__/compose-test.js index 7fe842e62..7c7847286 100644 --- a/app/soapbox/reducers/__tests__/compose-test.js +++ b/app/soapbox/reducers/__tests__/compose-test.js @@ -1,13 +1,11 @@ import reducer from '../compose'; import { Map as ImmutableMap } from 'immutable'; -//import { COMPOSE_REPLY } from 'soapbox/actions/compose'; import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS } from 'soapbox/actions/me'; import { SETTING_CHANGE } from 'soapbox/actions/settings'; 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'; +//import { STORE_HYDRATE } from 'soapbox/actions/store'; +//import { REDRAFT } from 'soapbox/actions/statuses'; +//import { TIMELINE_DELETE } from 'soapbox/actions/timelines'; describe('compose reducer', () => { it('returns the initial state by default', () => { @@ -155,18 +153,17 @@ describe('compose reducer', () => { }); it('should handle COMPOSE_UNMOUNT', () => { - const state = ImmutableMap({ mounted: 1, is_composing: true }); + const state = ImmutableMap({ mounted: 1}); 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 }); + it('should handle COMPOSE_SENSITIVITY_CHANGE on Mark Sensitive click, don\'t toggle if spoiler active', () => { + const state = ImmutableMap({ spoiler: true, sensitive: true}); const action = { type: actions.COMPOSE_SENSITIVITY_CHANGE, }; @@ -175,8 +172,8 @@ describe('compose reducer', () => { }); }); - it('should handle COMPOSE_SENSITIVITY_CHANGE, with sensitive icon click to toggle, with spoiler inactive', () => { - const state = ImmutableMap({ spoiler: false, sensitive: true }); + it('should handle COMPOSE_SENSITIVITY_CHANGE on Mark Sensitive click, toggle if spoiler inactive', () => { + const state = ImmutableMap({ spoiler: false, sensitive: true}); const action = { type: actions.COMPOSE_SENSITIVITY_CHANGE, }; @@ -186,7 +183,7 @@ describe('compose reducer', () => { }); // it('should handle COMPOSE_SPOILERNESS_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SPOILERNESS_CHANGE, // }; @@ -197,7 +194,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SPOILER_TEXT_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SPOILER_TEXT_CHANGE, // }; @@ -208,7 +205,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_VISIBILITY_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_VISIBILITY_CHANGE, // }; @@ -219,7 +216,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_CHANGE, // }; @@ -230,7 +227,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_COMPOSING_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_COMPOSING_CHANGE, // }; @@ -241,7 +238,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUBMIT_REQUEST', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUBMIT_REQUEST, // }; @@ -252,7 +249,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_CHANGE_REQUEST', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_CHANGE_REQUEST, // }; @@ -263,7 +260,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUBMIT_SUCCESS', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUBMIT_SUCCESS, // }; @@ -274,7 +271,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUBMIT_FAIL', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUBMIT_FAIL, // }; @@ -285,7 +282,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_CHANGE_FAIL', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_CHANGE_FAIL, // }; @@ -296,7 +293,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_REQUEST', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_REQUEST, // }; @@ -307,7 +304,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_SUCCESS', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_SUCCESS, // }; @@ -318,7 +315,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_FAIL', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_FAIL, // }; @@ -329,7 +326,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_UNDO', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_UNDO, // }; @@ -340,7 +337,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_PROGRESS', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_PROGRESS, // }; @@ -351,7 +348,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_MENTION', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_MENTION, // }; @@ -362,7 +359,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_DIRECT', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_DIRECT, // }; @@ -373,7 +370,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUGGESTIONS_CLEAR', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUGGESTIONS_CLEAR, // }; @@ -384,7 +381,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUGGESTIONS_READY', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUGGESTIONS_READY, // }; @@ -395,7 +392,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUGGESTION_SELECT', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUGGESTION_SELECT, // }; @@ -406,7 +403,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_SUGGESTION_TAGS_UPDATE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_SUGGESTION_TAGS_UPDATE, // }; @@ -417,7 +414,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_TAG_HISTORY_UPDATE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_TAG_HISTORY_UPDATE, // }; @@ -428,7 +425,7 @@ describe('compose reducer', () => { // }); // // it('should handle TIMELINE_DELETE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: TIMELINE_DELETE, // }; @@ -439,7 +436,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_EMOJI_INSERT', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_EMOJI_INSERT, // }; @@ -450,7 +447,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_UPLOAD_CHANGE_SUCCESS', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_UPLOAD_CHANGE_SUCCESS, // }; @@ -461,7 +458,7 @@ describe('compose reducer', () => { // }); // // it('should handle REDRAFT', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: REDRAFT, // }; @@ -472,7 +469,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_ADD', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_ADD, // }; @@ -483,7 +480,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_REMOVE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_REMOVE, // }; @@ -494,7 +491,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_OPTION_ADD', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_OPTION_ADD, // }; @@ -505,7 +502,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_OPTION_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_OPTION_CHANGE, // }; @@ -516,7 +513,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_OPTION_REMOVE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_OPTION_REMOVE, // }; @@ -527,7 +524,7 @@ describe('compose reducer', () => { // }); // // it('should handle COMPOSE_POLL_SETTINGS_CHANGE', () => { - // const state = ImmutableMap({ default_privacy: 'public' }); + // const state = ImmutableMap({ default_privacy: 'public', privacy: 'public'}); // const action = { // type: actions.COMPOSE_POLL_SETTINGS_CHANGE, // };