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