tutanota/test/tests/Suite.ts

192 lines
8 KiB
TypeScript
Raw Normal View History

2023-06-29 18:26:45 +02:00
import o from "@tutao/otest"
2023-06-29 18:26:45 +02:00
import "./misc/ListModelTest.js"
import "./api/worker/facades/LoginFacadeTest.js"
import "./api/common/utils/LoggerTest.js"
import "./api/common/utils/BirthdayUtilsTest.js"
import "./api/worker/rest/EntityRestClientTest.js"
import "./api/worker/crypto/CryptoFacadeTest.js"
import "./api/worker/crypto/OwnerEncSessionKeysUpdateQueueTest.js"
import "./api/worker/crypto/CompatibilityTest.js"
import "./api/common/error/RestErrorTest.js"
import "./api/common/error/TutanotaErrorTest.js"
import "./api/worker/rest/EntityRestCacheTest.js"
import "./api/worker/rest/EphemeralCacheStorageTest.js"
import "./api/worker/EventBusClientTest.js"
import "./api/worker/search/TokenizerTest.js"
import "./api/worker/search/IndexerTest.js"
import "./api/worker/search/IndexerCoreTest.js"
import "./api/worker/search/ContactIndexerTest.js"
import "./api/worker/search/GroupInfoIndexerTest.js"
import "./api/worker/search/MailIndexerTest.js"
import "./api/worker/search/IndexUtilsTest.js"
import "./api/worker/search/SearchFacadeTest.js"
import "./api/worker/search/SuggestionFacadeTest.js"
import "./api/worker/search/SearchIndexEncodingTest.js"
import "./serviceworker/SwTest.js"
import "./api/worker/search/EventQueueTest.js"
import "./api/worker/facades/MailFacadeTest.js"
import "./api/worker/facades/CalendarFacadeTest.js"
import "./api/worker/facades/UserFacadeTest.js"
import "./api/worker/SuspensionHandlerTest.js"
import "./api/worker/facades/ConfigurationDbTest.js"
import "./api/worker/CompressionTest.js"
import "./api/common/utils/PlainTextSearchTest.js"
import "./api/common/utils/EntityUtilsTest.js"
import "./api/worker/rest/CborDateEncoderTest.js"
import "./api/worker/facades/BlobFacadeTest.js"
import "./api/worker/facades/BlobAccessTokenFacadeTest.js"
import "./api/worker/utils/SleepDetectorTest.js"
import "./api/worker/rest/ServiceExecutorTest.js"
import "./api/worker/rest/CacheStorageProxyTest.js"
import "./contacts/VCardExporterTest.js"
import "./contacts/VCardImporterTest.js"
import "./misc/ClientDetectorTest.js"
import "./misc/LanguageViewModelTest.js"
2023-06-05 20:52:30 +02:00
import "./api/common/utils/CommonFormatterTest.js"
import "./misc/FormatterTest.js"
import "./api/worker/UrlifierTest.js"
import "./misc/PasswordUtilsTest.js"
import "./misc/PasswordGeneratorTest.js"
import "./misc/PasswordModelTest.js"
import "./gui/animation/AnimationsTest.js"
import "./gui/ThemeControllerTest.js"
import "./api/main/EntropyCollectorTest.js"
import "./misc/HtmlSanitizerTest.js"
import "./mail/InboxRuleHandlerTest.js"
import "./mail/MailUtilsSignatureTest.js"
import "./mail/MailModelTest.js"
import "./contacts/ContactUtilsTest.js"
import "./contacts/ContactMergeUtilsTest.js"
import "./calendar/CalendarModelTest.js"
import "./calendar/CalendarUtilsTest.js"
import "./calendar/CalendarParserTest.js"
import "./calendar/CalendarImporterTest.js"
import "./calendar/AlarmSchedulerTest.js"
import "./support/FaqModelTest.js"
import "./gui/base/WizardDialogNTest.js"
Rewrite calendar editor and calendar popup make updating calendar events delete the old uidIndex correctly when updating calendar events, we sometimes had events in the delete call that do not have the hashedUid set, causing us to be unable to delete the uid index entry. when re-creating the event, that leads to a db.exists error. make sure the event popup always has the current version of the event. now that edit operations are possible from the popup, we either need to close the popup after it calls the model factory to make sure it's only called once, or make sure the model factory always uses the last version of the event. we opted for the first option here to make sure repeated changes to the attendance are actually sent as a response. make contact resolution failure more controlled for external users previously, responding to an event from an external mailbox would try to resolve a contact for the response mail, fail, try to create a contact and fail again on an opaque assertNotNull. show partial editability banner when creating new event in shared calendar make it possible to add alarms to invites in private calendars don't make saving/sending invites and cancellations depend on user choice for own events updateExistingEvent() should call sendNotifications/saveEvent even when there are no update worthy changes or the user did not tick the sendUpdates checkbox because invites/cancellations must be sent in any case and sending updates has a separate check for sendUpdates also make the sendUpdates button on the popup use the same logic as the shortcut when clicked (ask confirmation) Co-authored-by: nig <nig@tutao.de>
2023-04-25 16:54:46 +02:00
import "./calendar/eventeditor/CalendarEventWhenModelTest.js"
import "./calendar/eventeditor/CalendarEventWhoModelTest.js"
import "./calendar/eventeditor/CalendarEventAlarmModelTest.js"
import "./calendar/eventeditor/CalendarEventModelTest.js"
import "./gui/ColorTest.js"
import "./mail/SendMailModelTest.js"
import "./misc/OutOfOfficeNotificationTest.js"
import "./subscription/PriceUtilsTest.js"
import "./subscription/SubscriptionUtilsTest.js"
import "./subscription/CreditCardViewModelTest.js"
import "./mail/TemplateSearchFilterTest.js"
import "./mail/KnowledgeBaseSearchFilterTest.js"
import "./mail/export/ExporterTest.js"
import "./mail/export/BundlerTest.js"
import "./api/common/utils/FileUtilsTest.js"
import "./gui/GuiUtilsTest.js"
import "./misc/ParserTest.js"
import "./misc/news/items/ReferralLinkNewsTest.js"
import "./settings/TemplateEditorModelTest.js"
2023-06-08 16:46:09 +02:00
import "./settings/mailaddress/MailAddressTableModelTest.js"
import "./settings/UserDataExportTest.js"
import "./settings/login/secondfactor/SecondFactorEditModelTest.js"
import "./misc/SchedulerTest.js"
import "./misc/parsing/MailAddressParserTest.js"
import "./misc/FormatValidatorTest.js"
import "./settings/whitelabel/CustomColorEditorTest.js"
import "./login/LoginViewModelTest.js"
import "./misc/credentials/CredentialsProviderTest.js"
import "./misc/DeviceConfigTest.js"
import "./calendar/EventDragHandlerTest.js"
import "./calendar/CalendarGuiUtilsTest.js"
import "./calendar/CalendarViewModelTest.js"
import "./calendar/eventeditor/CalendarNotificationModelTest.js"
import "./misc/credentials/NativeCredentialsEncryptionTest.js"
import "./misc/credentials/CredentialsKeyProviderTest.js"
import "./misc/webauthn/WebauthnClientTest.js"
import "./translations/TranslationKeysTest.js"
import "./misc/UsageTestModelTest.js"
2022-10-18 16:23:32 +02:00
import "./misc/NewsModelTest.js"
import "./file/FileControllerTest.js"
import "./api/worker/rest/CustomCacheHandlerTest.js"
import "./misc/RecipientsModelTest.js"
import "./api/worker/facades/MailAddressFacadeTest.js"
2022-12-19 16:38:14 +01:00
import "./mail/model/FolderSystemTest.js"
import "./gui/ScopedRouterTest.js"
import "./contacts/ContactListEditorTest.js"
import "./login/PostLoginUtilsTest.js"
import * as td from "testdouble"
2023-01-12 16:48:28 +01:00
import { random } from "@tutao/tutanota-crypto"
import { Mode } from "../../src/api/common/Env.js"
2023-06-29 18:26:45 +02:00
export async function run({ integration, filter }: { integration?: boolean; filter?: string } = {}) {
await setupSuite({ integration })
const result = await o.run({ filter })
2023-06-29 18:26:45 +02:00
o.printReport(result)
2023-06-29 18:26:45 +02:00
return result
}
2023-06-29 18:26:45 +02:00
async function setupSuite({ integration }: { integration?: boolean }) {
2023-01-12 16:48:28 +01:00
const { WorkerImpl } = await import("../../src/api/worker/WorkerImpl.js")
globalThis.testWorker = WorkerImpl
if (typeof process != "undefined") {
2023-06-29 18:26:45 +02:00
if (integration) {
console.log("\nRunning with integration tests because was run with -i\n")
await import("./api/main/WorkerTest.js")
await import("./IntegrationTest.js")
} else {
console.log("\nRunning without integration tests because run without -i\n")
}
}
if (typeof process != "undefined") {
// setup the Entropy for all testcases
2023-01-12 16:48:28 +01:00
await random.addEntropy([{ data: 36, entropy: 256, source: "key" }])
await import("./desktop/PathUtilsTest.js")
await import("./desktop/files/TempFsTest.js")
await import("./desktop/config/migrations/DesktopConfigMigratorTest.js")
await import("./desktop/ElectronUpdaterTest.js")
await import("./desktop/DesktopNotifierTest.js")
await import("./desktop/ApplicationWindowTest.js")
await import("./desktop/sse/DesktopSseClientTest.js")
await import("./desktop/sse/DesktopAlarmStorageTest.js")
await import("./desktop/sse/DesktopAlarmSchedulerTest.js")
await import("./desktop/files/DesktopFileFacadeTest.js")
await import("./desktop/net/ProtocolProxyTest.js")
await import("./desktop/SocketeerTest.js")
await import("./desktop/integration/DesktopIntegratorTest.js")
await import("./desktop/integration/RegistryScriptGeneratorTest.js")
await import("./desktop/DesktopCryptoFacadeTest.js")
await import("./desktop/DesktopContextMenuTest.js")
await import("./desktop/KeyStoreFacadeTest.js")
2022-12-27 15:37:40 +01:00
await import("./desktop/config/ConfigFileTest.js")
await import("./desktop/db/OfflineDbFacadeTest.js")
2022-12-27 15:37:40 +01:00
await import("./desktop/credentials/DesktopCredentialsEncryptionTest.js")
2022-06-20 16:13:40 +02:00
await import("./api/worker/offline/OfflineStorageMigratorTest.js")
await import("./api/worker/offline/OfflineStorageMigrationsTest.js")
2022-06-20 16:13:40 +02:00
await import("./api/worker/offline/OfflineStorageTest.js")
await import("./mail/view/ConversationViewModelTest.js")
await import("./desktop/config/DesktopConfigTest.js")
2023-07-26 18:06:29 +02:00
await import("./api/worker/rest/RestClientTest.js")
await import("./desktop/files/TempFsTest.js")
}
// testdouble complains about certain mocking related code smells, and also prints a warning whenever you replace a property on an object.
// it's very very noisy, so we turn it off
td.config({
2022-12-27 15:37:40 +01:00
ignoreWarnings: true,
})
o.before(async function () {
// setup the Entropy for all testcases
2023-01-12 16:48:28 +01:00
await random.addEntropy([{ data: 36, entropy: 256, source: "key" }])
})
o.afterEach(function () {
td.reset()
2023-06-29 18:26:45 +02:00
// Reset env.mode in case any tests have fiddled with it
env.mode = Mode.Test
})
}