mattermost-mobile/app/init/global_event_handler.test.js
Mattermost Build 31bd391e56 Automated cherry pick of #3033 (#3047)
* Clear foreground notifications from AsyncStorage

* Remove unnecessary call to clearNotifications
2019-07-26 08:11:58 -04: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();
});
});