
* Add language files * Add react-intl, mmjstool, setup for adding translations * Translated main module * Translations for renderer * A few minor fixes * More fixes * Add CI, add missing menu translations, other cleanup * Added setting to manually select the language of the app * Force English for E2e * Unit tests * Fix mmjstool * Move set language to before update menu * PR feedback
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import AutoLaunch from 'auto-launch';
|
|
|
|
import {AutoLauncher} from './AutoLauncher';
|
|
|
|
jest.mock('auto-launch', () => jest.fn());
|
|
jest.mock('electron', () => ({
|
|
app: {
|
|
name: 'Mattermost',
|
|
},
|
|
}));
|
|
|
|
jest.mock('electron-is-dev', () => false);
|
|
|
|
jest.mock('main/i18nManager', () => ({
|
|
localizeMessage: jest.fn(),
|
|
}));
|
|
|
|
describe('main/AutoLauncher', () => {
|
|
let autoLauncher;
|
|
const isEnabled = jest.fn();
|
|
const enable = jest.fn();
|
|
const disable = jest.fn();
|
|
|
|
beforeEach(() => {
|
|
AutoLaunch.mockImplementation(() => ({
|
|
isEnabled,
|
|
enable,
|
|
disable,
|
|
}));
|
|
autoLauncher = new AutoLauncher();
|
|
});
|
|
|
|
it('should toggle enabled/disabled', async () => {
|
|
isEnabled.mockReturnValue(true);
|
|
await autoLauncher.enable();
|
|
expect(enable).not.toBeCalled();
|
|
|
|
isEnabled.mockReturnValue(false);
|
|
await autoLauncher.enable();
|
|
expect(enable).toBeCalled();
|
|
|
|
isEnabled.mockReturnValue(false);
|
|
await autoLauncher.disable();
|
|
expect(disable).not.toBeCalled();
|
|
|
|
isEnabled.mockReturnValue(true);
|
|
await autoLauncher.disable();
|
|
expect(disable).toBeCalled();
|
|
});
|
|
});
|
|
|