[MM-43039] Upgrade and clean up dependencies (#2038)

* Upgrade Electron to v18

* Fix a test

* Upgrade ESLint and TypeScript

* Update Joi

* Clean up and upgrade dependencies

* Upgrade dev dependencies

* Upgrade to Webpack 5

* Update NOTICE.txt

* Update test runtime
This commit is contained in:
Devin Binnie
2022-04-06 19:08:27 -04:00
committed by GitHub
parent 61de4dfb7b
commit 0fea052a9b
20 changed files with 18096 additions and 20756 deletions

View File

@@ -261,28 +261,31 @@ describe('main/app/utils', () => {
expect(updatePaths).not.toHaveBeenCalled();
});
it('should copy all of the configs when they exist to the new directory', () => {
const migrationPrefs = {
getValue: () => false,
setValue: jest.fn(),
};
JsonFileManager.mockImplementation(() => migrationPrefs);
fs.readFileSync.mockReturnValue('config-data');
fs.existsSync.mockImplementation((path) => {
if (path === '/Library/Application Support/Mattermost') {
return true;
}
return ['config', 'app-state', 'bounds-info', 'migration-info'].some((filename) => path.endsWith(`${filename}.json`));
// this doesn't run on windows because of path resolution
if (process.platform !== 'win32') {
it('should copy all of the configs when they exist to the new directory', () => {
const migrationPrefs = {
getValue: () => false,
setValue: jest.fn(),
};
JsonFileManager.mockImplementation(() => migrationPrefs);
fs.readFileSync.mockReturnValue('config-data');
fs.existsSync.mockImplementation((path) => {
if (path === '/Library/Application Support/Mattermost') {
return true;
}
return ['config', 'app-state', 'bounds-info', 'migration-info'].some((filename) => path.endsWith(`${filename}.json`));
});
dialog.showMessageBoxSync.mockReturnValue(0);
dialog.showOpenDialogSync.mockReturnValue(['/old/data/path']);
migrateMacAppStore();
expect(fs.readFileSync).toHaveBeenCalledWith('/old/data/path/config.json');
expect(fs.writeFileSync).toHaveBeenCalledWith('/path/to/data/config.json', 'config-data');
expect(fs.readFileSync).not.toHaveBeenCalledWith('/old/data/path/allowedProtocols.json');
expect(fs.writeFileSync).not.toHaveBeenCalledWith('/path/to/data/allowedProtocols.json', 'config-data');
expect(updatePaths).toHaveBeenCalled();
expect(migrationPrefs.setValue).toHaveBeenCalledWith('masConfigs', true);
});
dialog.showMessageBoxSync.mockReturnValue(0);
dialog.showOpenDialogSync.mockReturnValue(['/old/data/path']);
migrateMacAppStore();
expect(fs.readFileSync).toHaveBeenCalledWith('/old/data/path/config.json');
expect(fs.writeFileSync).toHaveBeenCalledWith('/path/to/data/config.json', 'config-data');
expect(fs.readFileSync).not.toHaveBeenCalledWith('/old/data/path/allowedProtocols.json');
expect(fs.writeFileSync).not.toHaveBeenCalledWith('/path/to/data/allowedProtocols.json', 'config-data');
expect(updatePaths).toHaveBeenCalled();
expect(migrationPrefs.setValue).toHaveBeenCalledWith('masConfigs', true);
});
}
});
});