edited notifications_test

This commit is contained in:
crockwave 2020-07-13 20:00:55 -05:00
parent 3fe51e4885
commit 40f688a6be

View file

@ -7,6 +7,7 @@ import { take } from 'lodash';
import { SAVE_MARKERS_SUCCESS } from 'soapbox/actions/markers'; import { SAVE_MARKERS_SUCCESS } from 'soapbox/actions/markers';
// import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'soapbox/actions/accounts'; // import { ACCOUNT_BLOCK_SUCCESS, ACCOUNT_MUTE_SUCCESS } from 'soapbox/actions/accounts';
import notification from 'soapbox/__fixtures__/notification.json'; import notification from 'soapbox/__fixtures__/notification.json';
import intlMessages from 'soapbox/__fixtures__/intlMessages.json';
describe('notifications reducer', () => { describe('notifications reducer', () => {
it('should return the initial state', () => { it('should return the initial state', () => {
@ -219,25 +220,28 @@ describe('notifications reducer', () => {
})); }));
}); });
// it('should handle NOTIFICATIONS_UPDATE_QUEUE', () => { it('should handle NOTIFICATIONS_UPDATE_QUEUE', () => {
// const state = ImmutableMap({ const state = ImmutableMap({
// items: ImmutableList(), items: ImmutableList([]),
// queuedNotifications: ImmutableList([ take(notifications, 1) ]), queuedNotifications: ImmutableList([]),
// totalQueuedNotificationsCount: 1, totalQueuedNotificationsCount: 0,
// }); });
// const action = { const action = {
// type: actions.NOTIFICATIONS_UPDATE_QUEUE, type: actions.NOTIFICATIONS_UPDATE_QUEUE,
// notification: notification, notification: notification,
// intlMessages: intlMessages, intlMessages: intlMessages,
// intlLocale: 'en', intlLocale: 'en',
// }; };
// debugger; expect(reducer(state, action)).toEqual(ImmutableMap({
// expect(reducer(state, action)).toEqual(ImmutableMap({ items: ImmutableList([]),
// items: ImmutableList([]), queuedNotifications: ImmutableList([{
// queuedNotifications: ImmutableList([ take(notifications, 2), ImmutableMap( intlMessages ), 'en' ]), notification: notification,
// totalQueuedNotificationsCount: 2, intlMessages: intlMessages,
// })); intlLocale: 'en',
// }); }]),
totalQueuedNotificationsCount: 1,
}));
});
it('should handle NOTIFICATIONS_DEQUEUE', () => { it('should handle NOTIFICATIONS_DEQUEUE', () => {
const state = ImmutableMap({ const state = ImmutableMap({
@ -372,19 +376,21 @@ describe('notifications reducer', () => {
// it('should handle ACCOUNT_BLOCK_SUCCESS', () => { // it('should handle ACCOUNT_BLOCK_SUCCESS', () => {
// const relationship = ImmutableMap({ // const relationship = ImmutableMap({
// showing_reblogs: true, // relationship: ImmutableMap({
// followed_by: false, // // showing_reblogs: true,
// subscribing: false, // // followed_by: false,
// blocked_by: true, // // subscribing: false,
// requested: false, // // blocked_by: true,
// domain_blocking: false, // // requested: false,
// following: false, // // domain_blocking: false,
// endorsed: false, // // following: false,
// blocking: true, // // endorsed: false,
// muting: false, // // blocking: true,
// id: '9vMAje101ngtjlMj7w', // // muting: false,
// muting_notifications: false, // id: '9vMAje101ngtjlMj7w',
// }) // // muting_notifications: false,
// }),
// });
// const state = ImmutableMap({ // const state = ImmutableMap({
// items: ImmutableList([ // items: ImmutableList([
// ImmutableMap({ // ImmutableMap({
@ -417,21 +423,12 @@ describe('notifications reducer', () => {
// ]), // ]),
// }); // });
// const action = { // const action = {
// type: actions.ACCOUNT_BLOCK_SUCCESS, // type: ACCOUNT_BLOCK_SUCCESS,
// relationship: relationship, // relationship: relationship,
// }; // };
// expect(reducer(state, action)).toEqual(ImmutableMap({ // expect(reducer(state, action)).toEqual(ImmutableMap({
// items: ImmutableList([ // items: ImmutableList([
// ImmutableMap({ // ImmutableMap({
// id: '10744',
// type: 'pleroma:emoji_reaction',
// account: '9vMAje101ngtjlMj7w',
// created_at: '2020-06-10T02:54:39.000Z',
// status: '9vvNxoo5EFbbnfdXQu',
// emoji: '😢',
// is_seen: false,
// }),
// ImmutableMap({
// id: '10743', // id: '10743',
// type: 'favourite', // type: 'favourite',
// account: '9v5c6xSEgAi3Zu1Lv6', // account: '9v5c6xSEgAi3Zu1Lv6',
@ -452,21 +449,21 @@ describe('notifications reducer', () => {
// ]), // ]),
// })); // }));
// }); // });
//
// it('should handle ACCOUNT_MUTE_SUCCESS', () => { // it('should handle ACCOUNT_MUTE_SUCCESS', () => {
// const relationship = ImmutableMap({ // const relationship = ImmutableMap({
// showing_reblogs: true, // // showing_reblogs: true,
// followed_by: false, // // followed_by: false,
// subscribing: false, // // subscribing: false,
// blocked_by: true, // // blocked_by: false,
// requested: false, // // requested: false,
// domain_blocking: false, // // domain_blocking: false,
// following: false, // // following: false,
// endorsed: false, // // endorsed: false,
// blocking: true, // // blocking: true,
// muting: false, // // muting: false,
// id: '9vMAje101ngtjlMj7w', // id: '9vMAje101ngtjlMj7w',
// muting_notifications: true, // // muting_notifications: true,
// }) // })
// const state = ImmutableMap({ // const state = ImmutableMap({
// items: ImmutableList([ // items: ImmutableList([
@ -500,7 +497,7 @@ describe('notifications reducer', () => {
// ]), // ]),
// }); // });
// const action = { // const action = {
// type: actions.ACCOUNT_MUTE_SUCCESS, // type: ACCOUNT_MUTE_SUCCESS,
// relationship: relationship, // relationship: relationship,
// }; // };
// expect(reducer(state, action)).toEqual(ImmutableMap({ // expect(reducer(state, action)).toEqual(ImmutableMap({