feat(ci): CircleCI migration to Github Actions (#2516)
* Deprecated trigger-desktop-nightly repo from gitlab * Migrated Nightly builds URLs from CircleCI to S3 * Full CI/CD is handled by Github Actions --------- Co-authored-by: Tasos Boulis <tboulis@hotmail.com> Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:

committed by
GitHub

parent
8efa3480e4
commit
b62b25fdda
@@ -15,17 +15,21 @@ import {initialize} from './initialize';
|
||||
import {clearAppCache, getDeeplinkingURL, wasUpdated} from './utils';
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
unlinkSync: jest.fn(),
|
||||
accessSync: jest.fn(),
|
||||
existsSync: jest.fn().mockReturnValue(false),
|
||||
mkdirSync: jest.fn(),
|
||||
readFile: jest.fn(),
|
||||
readFileSync: jest.fn().mockImplementation((text) => text),
|
||||
unlinkSync: jest.fn(),
|
||||
writeFile: jest.fn(),
|
||||
|
||||
writeFileSync: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('path', () => {
|
||||
const original = jest.requireActual('path');
|
||||
return {
|
||||
...original,
|
||||
dirname: jest.fn().mockImplementation((p) => p),
|
||||
resolve: jest.fn(),
|
||||
};
|
||||
});
|
||||
@@ -33,6 +37,7 @@ jest.mock('path', () => {
|
||||
jest.mock('electron', () => ({
|
||||
app: {
|
||||
on: jest.fn(),
|
||||
handle: jest.fn(),
|
||||
exit: jest.fn(),
|
||||
getPath: jest.fn(),
|
||||
setPath: jest.fn(),
|
||||
@@ -118,6 +123,9 @@ jest.mock('main/app/utils', () => ({
|
||||
wasUpdated: jest.fn(),
|
||||
initCookieManager: jest.fn(),
|
||||
}));
|
||||
jest.mock('main/appState', () => ({
|
||||
on: jest.fn(),
|
||||
}));
|
||||
jest.mock('main/AppVersionManager', () => ({}));
|
||||
jest.mock('main/authManager', () => ({}));
|
||||
jest.mock('main/AutoLauncher', () => ({
|
||||
@@ -155,7 +163,16 @@ jest.mock('main/windows/windowManager', () => ({
|
||||
getServerNameByWebContentsId: jest.fn(),
|
||||
getServerURLFromWebContentsId: jest.fn(),
|
||||
}));
|
||||
const originalProcess = process;
|
||||
describe('main/app/initialize', () => {
|
||||
beforeAll(() => {
|
||||
global.process = {
|
||||
...originalProcess,
|
||||
on: jest.fn(),
|
||||
chdir: jest.fn(),
|
||||
cwd: jest.fn().mockImplementation((text) => text),
|
||||
};
|
||||
});
|
||||
beforeEach(() => {
|
||||
parseArgs.mockReturnValue({});
|
||||
Config.once.mockImplementation((event, cb) => {
|
||||
@@ -175,6 +192,10 @@ describe('main/app/initialize', () => {
|
||||
delete Config.data;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
global.process = originalProcess;
|
||||
});
|
||||
|
||||
it('should initialize without errors', async () => {
|
||||
await initialize();
|
||||
});
|
||||
|
@@ -116,6 +116,8 @@ describe('main/autoUpdater', () => {
|
||||
|
||||
afterEach(() => {
|
||||
jest.runAllTimers();
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should add a new timeout', () => {
|
||||
@@ -153,6 +155,12 @@ describe('main/autoUpdater', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should show dialog if update is not available', () => {
|
||||
autoUpdater.once.mockImplementation((event, callback) => {
|
||||
if (event === 'update-not-available') {
|
||||
|
@@ -124,6 +124,12 @@ describe('main/views/MattermostView', () => {
|
||||
mattermostView.retryInBackground = () => retryInBackgroundFn;
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should do nothing when webcontents are destroyed', () => {
|
||||
const webContents = mattermostView.view.webContents;
|
||||
mattermostView.view.webContents = null;
|
||||
@@ -180,6 +186,12 @@ describe('main/views/MattermostView', () => {
|
||||
mattermostView.findUnreadState = jest.fn();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should reset max retries', () => {
|
||||
mattermostView.maxRetries = 1;
|
||||
mattermostView.loadSuccess('http://server-1.com')();
|
||||
@@ -198,6 +210,12 @@ describe('main/views/MattermostView', () => {
|
||||
mattermostView.focus = jest.fn();
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should add browser view to window and set bounds when request is true and view not currently visible', () => {
|
||||
mattermostView.isVisible = false;
|
||||
mattermostView.show(true);
|
||||
|
@@ -72,6 +72,7 @@ export default class CallsWidgetWindow extends EventEmitter {
|
||||
|
||||
this.win.once('ready-to-show', () => this.win.show());
|
||||
this.win.once('show', this.onShow);
|
||||
|
||||
this.win.on('closed', this.onClosed);
|
||||
ipcMain.on(CALLS_WIDGET_RESIZE, this.onResize);
|
||||
ipcMain.on(CALLS_WIDGET_SHARE_SCREEN, this.onShareScreen);
|
||||
|
@@ -234,6 +234,9 @@ describe('main/windows/windowManager', () => {
|
||||
afterEach(() => {
|
||||
jest.runAllTimers();
|
||||
jest.resetAllMocks();
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should update loading screen and team dropdown bounds', () => {
|
||||
@@ -670,6 +673,12 @@ describe('main/windows/windowManager', () => {
|
||||
Config.teams = [];
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.runOnlyPendingTimers();
|
||||
jest.clearAllTimers();
|
||||
jest.useRealTimers();
|
||||
});
|
||||
|
||||
it('should do nothing if cannot find the server', () => {
|
||||
windowManager.switchServer('server-3');
|
||||
expect(getTabViewName).not.toBeCalled();
|
||||
|
Reference in New Issue
Block a user