2023-01-03 19:55:46 +00:00
|
|
|
// Copyright 2014 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2014-11-04 22:59:48 +00:00
|
|
|
/*
|
|
|
|
* global helpers for tests
|
|
|
|
*/
|
2014-11-16 21:19:51 +00:00
|
|
|
|
2023-01-13 00:24:59 +00:00
|
|
|
mocha.setup('bdd');
|
2022-09-01 18:56:25 +00:00
|
|
|
mocha.setup({ timeout: 10000 });
|
|
|
|
|
2023-10-04 00:12:57 +00:00
|
|
|
window.Events = {
|
|
|
|
getThemeSetting: () => 'light',
|
|
|
|
};
|
|
|
|
|
2015-04-16 01:02:44 +00:00
|
|
|
/* Delete the database before running any tests */
|
2018-07-25 22:02:37 +00:00
|
|
|
before(async () => {
|
2023-10-04 00:12:57 +00:00
|
|
|
await window.testUtilities.initialize();
|
2019-01-14 21:49:58 +00:00
|
|
|
await window.storage.fetch();
|
2018-07-25 22:02:37 +00:00
|
|
|
});
|
2018-04-03 15:39:08 +00:00
|
|
|
|
2023-01-13 00:24:59 +00:00
|
|
|
window.testUtilities.prepareTests();
|
|
|
|
delete window.testUtilities.prepareTests;
|
2023-10-04 00:12:57 +00:00
|
|
|
window.textsecure.storage.protocol = window.getSignalProtocolStore();
|
2023-01-13 00:24:59 +00:00
|
|
|
|
|
|
|
!(function () {
|
|
|
|
class Reporter extends Mocha.reporters.HTML {
|
|
|
|
constructor(runner, options) {
|
|
|
|
super(runner, options);
|
|
|
|
|
2024-06-28 00:22:06 +00:00
|
|
|
runner.on('pass', test => window.testUtilities.onTestEvent({
|
|
|
|
type: 'pass',
|
|
|
|
title: test.titlePath(),
|
2024-07-22 19:27:09 +00:00
|
|
|
duration: test.duration,
|
2024-06-28 00:22:06 +00:00
|
|
|
}));
|
|
|
|
runner.on('fail', (test, error) => window.testUtilities.onTestEvent({
|
|
|
|
type: 'fail',
|
|
|
|
title: test.titlePath(),
|
|
|
|
error: error?.stack || String(error),
|
|
|
|
}));
|
|
|
|
|
|
|
|
runner.on('end', () => window.testUtilities.onTestEvent({ type: 'end' }));
|
2023-01-13 00:24:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mocha.reporter(Reporter);
|
|
|
|
|
2024-06-28 00:22:06 +00:00
|
|
|
mocha.setup(window.testUtilities.setup);
|
|
|
|
|
2023-01-13 00:24:59 +00:00
|
|
|
mocha.run();
|
|
|
|
})();
|
2023-03-02 18:43:25 +00:00
|
|
|
|
|
|
|
window.getPreferredSystemLocales = () => ['en'];
|
2023-11-07 01:02:13 +00:00
|
|
|
window.getLocaleOverride = () => null;
|