2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
2022-06-13 21:39:35 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
|
|
|
|
import { ipcRenderer as ipc } from 'electron';
|
|
|
|
import { sync } from 'fast-glob';
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
|
|
import { assert } from 'chai';
|
|
|
|
|
2023-01-19 00:02:03 +00:00
|
|
|
import { getSignalProtocolStore } from '../../SignalProtocolStore';
|
2023-10-04 00:12:57 +00:00
|
|
|
import { initMessageCleanup } from '../../services/messageStateCleanup';
|
2023-04-11 03:54:43 +00:00
|
|
|
import { initializeMessageCounter } from '../../util/incrementMessageCounter';
|
2023-10-04 00:12:57 +00:00
|
|
|
import { initializeRedux } from '../../state/initializeRedux';
|
|
|
|
import * as Stickers from '../../types/Stickers';
|
2024-03-07 17:36:08 +00:00
|
|
|
import { ThemeType } from '../../types/Util';
|
2023-01-19 00:02:03 +00:00
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
window.assert = assert;
|
|
|
|
|
|
|
|
// This is a hack to let us run TypeScript tests in the renderer process. See the
|
2023-10-04 00:12:57 +00:00
|
|
|
// code in `test/test.js`.
|
2022-06-13 21:39:35 +00:00
|
|
|
|
|
|
|
window.testUtilities = {
|
2023-10-04 00:12:57 +00:00
|
|
|
debug(info) {
|
|
|
|
return ipc.invoke('ci:test-electron:debug', info);
|
|
|
|
},
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
onComplete(info) {
|
|
|
|
return ipc.invoke('ci:test-electron:done', info);
|
|
|
|
},
|
2023-10-04 00:12:57 +00:00
|
|
|
|
|
|
|
async initialize() {
|
|
|
|
initMessageCleanup();
|
|
|
|
await initializeMessageCounter();
|
|
|
|
await Stickers.load();
|
|
|
|
|
|
|
|
initializeRedux({
|
2024-04-01 19:19:35 +00:00
|
|
|
callLinks: [],
|
2023-10-04 00:12:57 +00:00
|
|
|
callsHistory: [],
|
2024-03-04 22:26:49 +00:00
|
|
|
callsHistoryUnreadCount: 0,
|
2023-10-04 00:12:57 +00:00
|
|
|
initialBadgesState: { byId: {} },
|
|
|
|
mainWindowStats: {
|
|
|
|
isFullScreen: false,
|
|
|
|
isMaximized: false,
|
|
|
|
},
|
|
|
|
menuOptions: {
|
|
|
|
development: false,
|
|
|
|
devTools: false,
|
|
|
|
includeSetup: false,
|
|
|
|
isProduction: false,
|
|
|
|
platform: 'test',
|
|
|
|
},
|
|
|
|
stories: [],
|
|
|
|
storyDistributionLists: [],
|
2024-03-07 17:36:08 +00:00
|
|
|
theme: ThemeType.dark,
|
2023-10-04 00:12:57 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
2022-06-13 21:39:35 +00:00
|
|
|
prepareTests() {
|
|
|
|
console.log('Preparing tests...');
|
|
|
|
sync('../../test-{both,electron}/**/*_test.js', {
|
|
|
|
absolute: true,
|
|
|
|
cwd: __dirname,
|
|
|
|
}).forEach(require);
|
|
|
|
},
|
|
|
|
};
|
2023-01-19 00:02:03 +00:00
|
|
|
|
|
|
|
window.getSignalProtocolStore = getSignalProtocolStore;
|