test editing

merge-requests/106/head
crockwave 4 years ago
parent 78d0955db2
commit 2018e5238b

@ -3,7 +3,7 @@ import { Map as ImmutableMap } from 'immutable';
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 { STORE_HYDRATE } from 'soapbox/actions/store';
//import { REDRAFT } from 'soapbox/actions/statuses';
import { TIMELINE_DELETE } from 'soapbox/actions/timelines';
@ -132,16 +132,22 @@ describe('compose reducer', () => {
});
// it('should handle STORE_HYDRATE', () => {
// const state = ImmutableMap({ compose: 'public' });
// const state = ImmutableMap({ });
// const action = {
// type: STORE_HYDRATE,
// state: ImmutableMap({
// compose: true,
// text: 'newtext',
// }),
// };
// expect(reducer.hydrate(state, action.toJS()).toMatchObject({
// default_privacy: 'unlisted',
// privacy: 'public',
// });
// expect(reducer(state, action)).toEqual(ImmutableMap({
// state: ImmutableMap({
// compose: true,
// text: 'newtext',
// }),
// }));
// });
//
it('should handle COMPOSE_MOUNT', () => {
const state = ImmutableMap({ mounted: 1 });
const action = {
@ -336,26 +342,25 @@ describe('compose reducer', () => {
});
// it('should handle COMPOSE_UPLOAD_UNDO', () => {
// const state = ImmutableMap({ media_attachments: [] });
// const state = ImmutableMap({
// media_attachments: ImmutableList([
// description: null,
// id: '1375732379',
// pleroma: {
// mime_type: 'image/jpeg'
// },
// preview_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// remote_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// text_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// type: 'image',
// url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg'
// ]),
// });
// const action = {
// type: actions.COMPOSE_UPLOAD_UNDO,
// media_attachments: [
// {
// description: null,
// id: '1375732379',
// pleroma: {
// mime_type: 'image/jpeg'
// },
// preview_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// remote_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// text_url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg',
// type: 'image',
// url: 'https://media.gleasonator.com/media_attachments/files/000/853/856/original/7035d67937053e1d.jpg'
// }
// ],
// mediaId: '1375732379',
// };
// expect(reducer(state, action).toJS()).toMatchObject({
// expect(reducer(state, action)).toEqual({
// media_attachments: [],
// });
// });

@ -1,27 +0,0 @@
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',
]),
}));
});
});

@ -1,4 +1,5 @@
import reducer from '../modal';
import { MODAL_OPEN, MODAL_CLOSE } from 'soapbox/actions/modal';
describe('modal reducer', () => {
it('should return the initial state', () => {
@ -7,4 +8,37 @@ describe('modal reducer', () => {
modalProps: {},
});
});
it('should handle MODAL_OPEN', () => {
const state = {
modalType: null,
modalProps: {},
}
const action = {
type: MODAL_OPEN,
modalType: 'type1',
modalProps: { props1: '1' },
}
debugger;
expect(reducer(state, action)).toMatchObject({
modalType: 'type1',
modalProps: { props1: '1' },
});
});
it('should handle MODAL_CLOSE', () => {
const state = {
modalType: 'type1',
modalProps: { props1: '1' },
}
const action = {
type: MODAL_CLOSE,
}
debugger;
expect(reducer(state, action)).toMatchObject({
modalType: null,
modalProps: {},
});
});
});

@ -1,5 +1,9 @@
import reducer from '../mutes';
import { Map as ImmutableMap } from 'immutable';
import {
MUTES_INIT_MODAL,
MUTES_TOGGLE_HIDE_NOTIFICATIONS,
} from 'soapbox/actions/mutes';
describe('mutes reducer', () => {
it('should return the initial state', () => {
@ -11,4 +15,42 @@ describe('mutes reducer', () => {
}),
}));
});
it('should handle MUTES_INIT_MODAL', () => {
const state = ImmutableMap({
new: ImmutableMap({
isSubmitting: false,
account: null,
notifications: true,
}),
});
const action = {
type: MUTES_INIT_MODAL,
account: 'account1',
}
expect(reducer(state, action)).toEqual(ImmutableMap({
new: ImmutableMap({
isSubmitting: false,
account: 'account1',
notifications: true,
}),
}));
});
it('should handle MUTES_TOGGLE_HIDE_NOTIFICATIONS', () => {
const state = ImmutableMap({
new: ImmutableMap({
notifications: true,
}),
});
const action = {
type: MUTES_TOGGLE_HIDE_NOTIFICATIONS,
}
expect(reducer(state, action)).toEqual(ImmutableMap({
new: ImmutableMap({
notifications: false,
}),
}));
});
});

Loading…
Cancel
Save