mattermost-mobile/app/init/global_event_handler.test.js
Miguel Alatzar 4ee4ff10dd [MM-14926] Clear foreground notifications from AsyncStorage on logout and server upgrade (#3033)
* Clear foreground notifications from AsyncStorage

* Remove unnecessary call to clearNotifications
2019-07-26 18:21:11 +08:00

28 lines
No EOL
916 B
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import PushNotification from 'app/push_notifications';
import GlobalEventHandler from './global_event_handler';
jest.mock('app/init/credentials', () => ({
getAppCredentials: jest.fn(),
removeAppCredentials: jest.fn(),
}));
const mockStore = configureMockStore([thunk]);
const store = mockStore({});
GlobalEventHandler.store = store;
// TODO: Add Android test as part of https://mattermost.atlassian.net/browse/MM-17110
describe('GlobalEventHandler', () => {
it('should clear notifications on logout', () => {
const clearNotifications = jest.spyOn(PushNotification, 'clearNotifications');
GlobalEventHandler.onLogout();
expect(clearNotifications).toHaveBeenCalled();
});
});