signal-desktop/ts/windows/main/preload_test.ts
2023-04-10 20:54:43 -07:00

40 lines
1.1 KiB
TypeScript

// Copyright 2021 Signal Messenger, LLC
// 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';
import { getSignalProtocolStore } from '../../SignalProtocolStore';
import { MessageController } from '../../util/MessageController';
import { initializeMessageCounter } from '../../util/incrementMessageCounter';
window.assert = assert;
// This is a hack to let us run TypeScript tests in the renderer process. See the
// code in `test/index.html`.
window.testUtilities = {
onComplete(info) {
return ipc.invoke('ci:test-electron:done', info);
},
prepareTests() {
console.log('Preparing tests...');
sync('../../test-{both,electron}/**/*_test.js', {
absolute: true,
cwd: __dirname,
}).forEach(require);
},
installMessageController() {
MessageController.install();
},
initializeMessageCounter() {
return initializeMessageCounter();
},
};
window.getSignalProtocolStore = getSignalProtocolStore;