Merge api/client tests into a single entry point

This commit is contained in:
ivk 2022-05-12 16:51:15 +02:00 committed by Ivan Kupalov
parent 86e180b2c8
commit 7ec57e1190
134 changed files with 1121 additions and 1318 deletions

View file

@ -15,9 +15,8 @@
"build-packages": "npm run build -ws", "build-packages": "npm run build -ws",
"build-runtime-packages": "npm run build -w @tutao/tutanota-utils && npm run build -w @tutao/tutanota-crypto", "build-runtime-packages": "npm run build -w @tutao/tutanota-utils && npm run build -w @tutao/tutanota-crypto",
"start": "./start-desktop.sh", "start": "./start-desktop.sh",
"test": "npm run build-packages; npm run --if-present test -ws && cd test && node --icu-data-dir=../node_modules/full-icu test", "test": "npm run --if-present test -ws && cd test && node test",
"testapi": "cd test && node --icu-data-dir=../node_modules/full-icu test api", "test:app": "cd test && node test",
"testclient": "cd test && node --icu-data-dir=../node_modules/full-icu test client",
"fasttest": "cd test && node --icu-data-dir=../node_modules/full-icu fastTest", "fasttest": "cd test && node --icu-data-dir=../node_modules/full-icu fastTest",
"types": "tsc --incremental true --noEmit true", "types": "tsc --incremental true --noEmit true",
"prebuild": "node buildSrc/prebuild.js", "prebuild": "node buildSrc/prebuild.js",

View file

@ -30,13 +30,12 @@ export async function runTestBuild({clean}) {
const pjPath = path.join("..", "package.json") const pjPath = path.join("..", "package.json")
await fs.mkdir(inBuildDir(), {recursive: true}) await fs.mkdir(inBuildDir(), {recursive: true})
await fs.copyFile(pjPath, inBuildDir("package.json")) await fs.copyFile(pjPath, inBuildDir("package.json"))
await createUnitTestHtml("api", localEnv) await createUnitTestHtml(localEnv)
await createUnitTestHtml("client", localEnv)
}) })
await runStep("Esbuild", async () => { await runStep("Esbuild", async () => {
await esbuild({ await esbuild({
entryPoints: ["api/bootstrapTests-api.ts", "client/bootstrapTests-client.ts"], entryPoints: ["tests/bootstrapTests.ts"],
outdir: "./build", outdir: "./build",
// Bundle to include the whole graph // Bundle to include the whole graph
bundle: true, bundle: true,
@ -44,6 +43,7 @@ export async function runTestBuild({clean}) {
splitting: true, splitting: true,
format: "esm", format: "esm",
sourcemap: "linked", sourcemap: "linked",
target: "esnext",
define: { define: {
// See Env.ts for explanation // See Env.ts for explanation
"NO_THREAD_ASSERTIONS": 'true', "NO_THREAD_ASSERTIONS": 'true',
@ -87,18 +87,14 @@ export async function runTestBuild({clean}) {
}) })
} }
async function createUnitTestHtml(project, localEnv) { async function createUnitTestHtml(localEnv) {
const imports = [{src: `test-${project}.js`, type: "module"}] const imports = [{src: `./bootstrapTests.js`, type: "module"}]
const htmlFilePath = inBuildDir("test.html")
const template = `import('./${project}/bootstrapTests-${project}.js')` console.log(`Generating browser tests at "${htmlFilePath}"`)
const targetFile = inBuildDir(`test-${project}.html`)
console.log(`Generating browser tests for ${project} at "${targetFile}"`)
const bootstrap = `window.whitelabelCustomizations = null
${template}`
await writeFile(inBuildDir(`test-${project}.js`), bootstrap)
const html = await renderHtml(imports, localEnv) const html = await renderHtml(imports, localEnv)
await writeFile(targetFile, html) await writeFile(htmlFilePath, html)
} }
function inBuildDir(...files) { function inBuildDir(...files) {

View file

@ -1,82 +0,0 @@
import o from "ospec"
import "./worker/facades/LoginFacadeTest.js"
import "./common/LoggerTest.js"
import "./common/BirthdayUtilsTest"
import "./rest/EntityRestClientTest"
import "./crypto/CryptoFacadeTest.js"
import "./crypto/CompatibilityTest"
import "./error/RestErrorTest"
import "./error/TutanotaErrorTest"
import "./rest/RestClientTest"
import "./rest/EntityRestCacheTest"
import "./worker/EventBusClientTest"
import "./worker/search/TokenizerTest"
import "./worker/search/IndexerTest"
import "./worker/search/IndexerCoreTest"
import "./worker/search/ContactIndexerTest"
import "./worker/search/GroupInfoIndexerTest"
import "./worker/search/MailIndexerTest"
import "./worker/search/IndexUtilsTest"
import "./worker/search/SearchFacadeTest"
import "./worker/search/SuggestionFacadeTest"
import "./worker/search/SearchIndexEncodingTest"
import "./common/SwTest"
import "./worker/search/EventQueueTest"
import "./common/IndexerDebugLoggerTest"
import "./worker/facades/MailFacadeTest"
import "./worker/facades/CalendarFacadeTest"
import "./worker/SuspensionHandlerTest"
import "./worker/ConfigurationDbTest"
import "./worker/CompressionTest"
import "../api/common/PlainTextSearchTest"
import "../api/common/EntityUtilsTest"
import "./rest/CborDateEncoderTest.js"
import "./worker/facades/BlobFacadeTest.js"
import "./worker/utils/SleepDetectorTest.js"
import "./worker/rest/ServiceExecutorTest.js"
import "./worker/rest/OfflineStorageTest.js"
import {preTest, reportTest} from "./TestUtils"
import {random} from "@tutao/tutanota-crypto"
import * as td from "testdouble"
import {Mode} from "../../src/api/common/Env.js"
(async function () {
const {WorkerImpl} = await import("../../src/api/worker/WorkerImpl")
globalThis.testWorker = WorkerImpl
if (typeof process != "undefined") {
if (process.argv.includes("-i")) {
console.log("\nRunning with integration tests because was run with -i\n")
await import("./common/WorkerTest")
await import("./common/IntegrationTest")
} else {
console.log("\nRunning without integration tests because run without -i\n")
}
}
o.before(async function () {
preTest()
// 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({
ignoreWarnings: true
})
// setup the Entropy for all testcases
await random.addEntropy([{data: 36, entropy: 256, source: "key"}])
})
o.afterEach(function () {
td.reset()
// Reset env.mode in case any tests have fiddled with it
env.mode = Mode.Test
})
// @ts-ignore
o.run(reportTest)
})()

View file

@ -1,99 +0,0 @@
// @ts-nocheck
// import env from "@tutanota/env"
import * as env from "../../buildSrc/env.js"
import {promises as fs} from "fs"
import path, {dirname} from "path"
import {fileURLToPath} from "url"
const testRoot = dirname(fileURLToPath(import.meta.url))
const projectRoot = path.resolve(path.join(testRoot, ".."))
const pjPath = path.join(projectRoot, "package.json")
const {version} = JSON.parse(await fs.readFile(pjPath, "utf8"))
globalThis.env = env.create({staticUrl: "http://localhost:9000", version, mode: "Test", dist: false})
globalThis.buildOptions = {sqliteNativePath: "./native-cache/node/better-sqlite3-7.5.0-linux.node"}
globalThis.isBrowser = typeof window !== "undefined"
;(async function () {
const noOp = () => {
}
if (isBrowser) {
/**
* runs this test exclusively on browsers (not nodec)
*/
window.browser = (func) => func
/**
* runs this test exclusively on node (not browsers)
*/
window.node = () => noOp
} else {
/**
* runs this test exclusively on browsers (not node)
*/
globalThis.browser = () => noOp
/**
* runs this test exclusively on node (not browsers)
*/
globalThis.node = (func) => func
const browserMock = await import("mithril/test-utils/browserMock")
globalThis.window = browserMock.default()
globalThis.window.getElementsByTagName = function () {
} // for styles.js
globalThis.window.location = {hostname: "https://tutanota.com"}
globalThis.window.document.addEventListener = function () {
}
globalThis.document = globalThis.window.document
globalThis.navigator = globalThis.window.navigator
const local = {}
globalThis.localStorage = {
getItem: key => local[key],
setItem: (key, value) => local[key] = value
}
globalThis.requestAnimationFrame = globalThis.requestAnimationFrame || (callback => setTimeout(callback, 10))
globalThis.btoa = str => Buffer.from(str, 'binary').toString('base64')
globalThis.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary')
globalThis.WebSocket = noOp
const nowOffset = Date.now();
globalThis.performance = {
now: function () {
return Date.now() - nowOffset;
}
}
globalThis.performance = {
now: Date.now,
mark: noOp,
measure: noOp,
}
const crypto = await import("crypto")
globalThis.crypto = {
getRandomValues: function (bytes) {
let randomBytes = crypto.randomBytes(bytes.length)
bytes.set(randomBytes)
}
}
window.tutao = {
appState: {
prefixWithoutFile: "./"
}
}
globalThis.XMLHttpRequest = (await import("xhr2")).default
globalThis.express = (await import("express")).default
globalThis.bodyParser = (await import("body-parser")).default
}
const Env = await import("../../src/api/common/Env")
Env.bootFinished()
import('./Suite.js')
})()

View file

@ -1,84 +0,0 @@
// @ts-nocheck
globalThis.isBrowser = typeof window !== "undefined"
;(async function () {
const noOp = () => {}
if (isBrowser) {
/**
* runs this test exclusively on browsers (not nodec)
*/
window.browser = (func) => func
/**
* runs this test exclusively on node (not browsers)
*/
window.node = () => noOp
} else {
/**
* runs this test exclusively on browsers (not node)
*/
globalThis.browser = () => noOp
/**
* runs this test exclusively on node (not browsers)
*/
globalThis.node = (func) => func
const browserMock = await import("mithril/test-utils/browserMock.js")
globalThis.window = browserMock.default()
globalThis.window.getElementsByTagName = function () {
} // for styles.js
globalThis.window.location = {hostname: "https://tutanota.com"}
globalThis.window.document.addEventListener = function () {
}
globalThis.document = globalThis.window.document
globalThis.navigator = globalThis.window.navigator
const local = {}
globalThis.localStorage = {
getItem: key => local[key],
setItem: (key, value) => local[key] = value
}
globalThis.requestAnimationFrame = globalThis.requestAnimationFrame || (callback => setTimeout(callback, 10))
globalThis.btoa = str => Buffer.from(str, 'binary').toString('base64')
globalThis.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary')
globalThis.WebSocket = noOp
const nowOffset = Date.now();
globalThis.performance = {
now: function () {
return Date.now() - nowOffset;
}
}
globalThis.performance = {
now: Date.now,
mark: noOp,
measure: noOp,
}
const crypto = await import("crypto")
globalThis.crypto = {
getRandomValues: function (bytes) {
let randomBytes = crypto.randomBytes(bytes.length)
bytes.set(randomBytes)
}
}
window.tutao = {
appState: {
prefixWithoutFile: "./"
}
}
globalThis.XMLHttpRequest = (await import("xhr2")).default
globalThis.express = (await import("express")).default
globalThis.bodyParser = (await import("body-parser")).default
}
const Env = await import("../../src/api/common/Env")
Env.bootFinished()
import('./Suite.js')
})()

View file

@ -1,108 +0,0 @@
import "./contact/VCardExporterTest"
import "./contact/VCardImporterTest"
import "./common/ClientDetectorTest"
import "./common/LanguageViewModelTest"
import "./common/FormatterTest"
import "./common/UrlifierTest"
import "./common/PasswordUtilsTest"
import "./gui/animation/AnimationsTest"
import "./gui/base/ListTest"
import "./gui/ThemeControllerTest"
import "./common/EntropyCollectorTest"
import "./common/HtmlSanitizerTest"
import "./mail/InboxRuleHandlerTest"
import "./mail/MailUtilsTest"
import "./mail/MailUtilsSignatureTest"
import "./mail/MailModelTest"
import "./contact/ContactUtilsTest"
import "./contact/ContactMergeUtilsTest"
import "./calendar/CalendarModelTest"
import "./calendar/CalendarUtilsTest"
import "./calendar/CalendarParserTest"
import "./calendar/CalendarImporterTest"
import "./calendar/AlarmSchedulerTest"
import "./support/FaqModelTest"
import "./gui/base/WizardDialogNTest"
import "./calendar/CalendarEventViewModelTest"
import "./gui/ColorTest"
import "./mail/SendMailModelTest"
import "./common/OutOfOfficeNotificationTest"
import "./subscription/SubscriptionUtilsTest"
import "./subscription/SwitchSubscriptionDialogModelTest"
import "./mail/TemplateSearchFilterTest"
import "./mail/KnowledgeBaseSearchFilterTest"
import "./mail/export/ExporterTest"
import "./mail/export/BundlerTest"
import "./common/utils/FileUtilsTest"
import "./gui/GuiUtilsTest"
import "./misc/ParserTest"
import "./templates/TemplateEditorModelTest"
import "./misc/SchedulerTest"
import "./subscription/PriceUtilsTest"
import "./misc/parsing/MailAddressParserTest"
import "./misc/FormatValidatorTest"
import "./whitelabel/CustomColorEditorTest"
import "./login/LoginViewModelTest"
import "./misc/credentials/CredentialsProviderTest"
import "./misc/DeviceConfigTest"
import "./calendar/EventDragHandlerTest"
import "./calendar/CalendarGuiUtilsTest"
import "./calendar/CalendarViewModelTest"
import "./misc/credentials/NativeCredentialsEncryptionTest"
import "./misc/credentials/CredentialsKeyProviderTest"
import "./misc/credentials/CredentialsMigrationTest"
import "./misc/webauthn/WebauthnClientTest.js"
import "./common/TranslationKeysTest"
import "./misc/UsageTestModelTest.js"
import "./file/FileControllerTest.js"
import o from "ospec"
import {preTest, reportTest} from "../api/TestUtils"
import * as td from "testdouble"
import {random} from "@tutao/tutanota-crypto"
(async () => {
if (typeof process != "undefined") {
// setup the Entropy for all testcases
await random.addEntropy([{data: 36, entropy: 256, source: "key"}])
await import("./desktop/PathUtilsTest.js")
await import("./desktop/config/migrations/DesktopConfigMigratorTest")
await import("./desktop/ElectronUpdaterTest")
await import("./desktop/DesktopNotifierTest")
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/DesktopDownloadManagerTest.js")
await import("./desktop/IPCTest.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")
await import ("./desktop/config/ConfigFileTest.js")
await import("./desktop/db/OfflineDbTest")
await import("./desktop/db/OfflineDbFacadeTest")
await import ("./desktop/credentials/DesktopCredentialsEncryptionTest")
}
o.before(function () {
// 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({
ignoreWarnings: true
})
})
o.afterEach(function () {
td.reset()
})
preTest()
// @ts-ignore
o.run(reportTest)
})()

View file

@ -1,94 +0,0 @@
// @ts-nocheck
globalThis.isBrowser = typeof window !== "undefined"
globalThis.mocks = {}
;(async function () {
const noOp = () => {}
// Until we get rid of random worker imports we have to stub it somehow
globalThis.testWorker = class WorkerImpl {
constructor() {
this._queue = {
_handleMessage: noOp,
}
}
}
if (isBrowser) {
/**
* runs this test exclusively on browsers (not nodec)
*/
window.browser = (func) => func
/**
* runs this test exclusively on node (not browsers)
*/
window.node = () => noOp
} else {
const noOp = () => {}
/**
* runs this test exclusively on browsers (not node)
*/
globalThis.browser = () => noOp
/**
* runs this test exclusively on node (not browsers)
*/
globalThis.node = (func) => func
const browserMock = await import("mithril/test-utils/browserMock.js")
globalThis.window = browserMock.default()
globalThis.window.getElementsByTagName = function () {
} // for styles.js
globalThis.window.location = {hostname: "tutanota.com", search: "", href:"http://tutanota.com"}
globalThis.window.document.addEventListener = function () {
}
globalThis.document = globalThis.window.document
globalThis.navigator = globalThis.window.navigator
const local = {}
globalThis.localStorage = {
getItem: key => local[key],
setItem: (key, value) => local[key] = value
}
globalThis.requestAnimationFrame = globalThis.requestAnimationFrame || (callback => setTimeout(callback, 10))
globalThis.btoa = str => Buffer.from(str, 'binary').toString('base64')
globalThis.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary')
globalThis.WebSocket = noOp
const nowOffset = Date.now();
globalThis.performance = {
now: function () {
return Date.now() - nowOffset;
}
}
globalThis.performance = {
now: Date.now,
mark: noOp,
measure: noOp,
}
const crypto = await import("crypto")
globalThis.crypto = {
getRandomValues: function (bytes) {
let randomBytes = crypto.randomBytes(bytes.length)
bytes.set(randomBytes)
}
}
window.crypto = globalThis.crypto
globalThis.XMLHttpRequest = (await import("xhr2")).default
process.on("unhandledRejection", function (e) {
console.log("Uncaught (in promise) " + e.stack)
})
globalThis.electronMock = {
app: {}
}
}
window.tutao = {}
const Env = await import("../../src/api/common/Env.js")
Env.bootFinished()
import('./Suite.js')
})()

View file

@ -1,39 +1,30 @@
import child_process from "child_process" import child_process from "child_process"
import {runTestBuild} from "./TestBuilder.js" import {runTestBuild} from "./TestBuilder.js"
import {Argument, Option, program} from "commander" import {Option, program} from "commander"
await program await program
.addArgument(new Argument("project")
.choices(["api", "client"])
.argOptional()
)
.addOption(new Option("-i, --integration", "Include integration tests (requires local server)")) .addOption(new Option("-i, --integration", "Include integration tests (requires local server)"))
.addOption(new Option("-c, --clean")) .addOption(new Option("-c, --clean"))
.action(async (project, {clean, integration}) => { .action(async ({clean, integration}) => {
await runTestBuild({clean}) await runTestBuild({clean})
console.log("build finished!") console.log("build finished!")
const testProjects = project ? [project] : ["api", "client"] await runTestsAndExit(integration)
await runTestsAndExit(testProjects, integration)
}) })
.parseAsync(process.argv) .parseAsync(process.argv)
/** Function which runs tests for {@param projects} and exits with the most suitable code afterwards. */ /** Function which runs tests and exits with the exit code afterwards. */
async function runTestsAndExit(projects, integration) { async function runTestsAndExit(integration) {
const codes = [] const code = await runTest(integration)
for (const project of projects) {
codes.push(await runTest(project, integration))
}
const code = codes.find((code) => code !== 0) ?? 0
process.exit(code) process.exit(code)
} }
function runTest(project, integration) { function runTest(integration) {
return new Promise((resolve) => { return new Promise((resolve) => {
console.log("running", project, "tests") console.log("running tests")
const args = integration ? ["-i"] : [] const args = integration ? ["-i"] : []
// We fork because ospec is very weird and doesn't just let you wait for the results unless you do something with report // We fork because ospec is very weird and doesn't just let you wait for the results unless you do something with report
const testProcess = child_process.fork(`./build/${project}/bootstrapTests-${project}.js`, args) const testProcess = child_process.fork(`./build/bootstrapTests.js`, args)
testProcess.on('exit', resolve) testProcess.on('exit', resolve)
}) })
} }

View file

@ -1,16 +1,16 @@
import o from "ospec" import o from "ospec"
import {GroupType} from "../../../src/api/common/TutanotaConstants" import {GroupType} from "../../src/api/common/TutanotaConstants.js"
import {ContactTypeRef, createContact} from "../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef, createContact} from "../../src/api/entities/tutanota/TypeRefs.js"
import {MailTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../src/api/entities/tutanota/TypeRefs.js"
import {createContactAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactAddress} from "../../src/api/entities/tutanota/TypeRefs.js"
import type {MailFolder} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {MailFolder} from "../../src/api/entities/tutanota/TypeRefs.js"
import {MailFolderTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {MailFolderTypeRef} from "../../src/api/entities/tutanota/TypeRefs.js"
import {MailBoxTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {MailBoxTypeRef} from "../../src/api/entities/tutanota/TypeRefs.js"
import {neverNull} from "@tutao/tutanota-utils" import {neverNull} from "@tutao/tutanota-utils"
import {ContactListTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {ContactListTypeRef} from "../../src/api/entities/tutanota/TypeRefs.js"
import {initLocator, locator} from "../../../src/api/worker/WorkerLocator" import {initLocator, locator} from "../../src/api/worker/WorkerLocator.js"
import {browserDataStub} from "../TestUtils" import {browserDataStub} from "./TestUtils.js"
import {SessionType} from "../../../src/api/common/SessionType" import {SessionType} from "../../src/api/common/SessionType.js"
function loadFolders(folderListId: Id): Promise<MailFolder[]> { function loadFolders(folderListId: Id): Promise<MailFolder[]> {
return locator.cachingEntityClient.loadAll(MailFolderTypeRef, folderListId) return locator.cachingEntityClient.loadAll(MailFolderTypeRef, folderListId)

188
test/tests/Suite.ts Normal file
View file

@ -0,0 +1,188 @@
import o from "ospec"
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/CompatibilityTest.js"
import "./api/common/error/RestErrorTest.js"
import "./api/common/error/TutanotaErrorTest.js"
import "./api/worker/rest/RestClientTest.js"
import "./api/worker/rest/EntityRestCacheTest.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/common/utils/IndexerDebugLoggerTest.js"
import "./api/worker/facades/MailFacadeTest.js"
import "./api/worker/facades/CalendarFacadeTest.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/utils/SleepDetectorTest.js"
import "./api/worker/rest/ServiceExecutorTest.js"
import "./api/worker/rest/OfflineStorageTest.js"
import "./contacts/VCardExporterTest.js"
import "./contacts/VCardImporterTest.js"
import "./misc/ClientDetectorTest.js"
import "./misc/LanguageViewModelTest.js"
import "./misc/FormatterTest.js"
import "./api/worker/UrlifierTest.js"
import "./misc/PasswordUtilsTest.js"
import "./gui/animation/AnimationsTest.js"
import "./gui/base/ListTest.js"
import "./gui/ThemeControllerTest.js"
import "./api/main/EntropyCollectorTest.js"
import "./misc/HtmlSanitizerTest.js"
import "./mail/InboxRuleHandlerTest.js"
import "./mail/MailUtilsTest.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"
import "./calendar/CalendarEventViewModelTest.js"
import "./gui/ColorTest.js"
import "./mail/SendMailModelTest.js"
import "./misc/OutOfOfficeNotificationTest.js"
import "./subscription/SubscriptionUtilsTest.js"
import "./subscription/SwitchSubscriptionDialogModelTest.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 "./settings/TemplateEditorModelTest.js"
import "./misc/SchedulerTest.js"
import "./subscription/PriceUtilsTest.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 "./misc/credentials/NativeCredentialsEncryptionTest.js"
import "./misc/credentials/CredentialsKeyProviderTest.js"
import "./misc/credentials/CredentialsMigrationTest.js"
import "./misc/webauthn/WebauthnClientTest.js"
import "./translations/TranslationKeysTest.js"
import "./misc/UsageTestModelTest.js"
import "./file/FileControllerTest.js"
import * as td from "testdouble"
import {random} from "@tutao/tutanota-crypto"
import {Mode} from "../../src/api/common/Env.js"
import {assertNotNull, neverNull} from "@tutao/tutanota-utils"
await setupSuite()
preTest()
// @ts-ignore
o.run(reportTest)
async function setupSuite() {
const {WorkerImpl} = await import("../../src/api/worker/WorkerImpl.js")
globalThis.testWorker = WorkerImpl
if (typeof process != "undefined") {
if (process.argv.includes("-i")) {
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
await random.addEntropy([{data: 36, entropy: 256, source: "key"}])
await import("./desktop/PathUtilsTest.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/DesktopDownloadManagerTest.js")
await import("./desktop/IPCTest.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")
await import ("./desktop/config/ConfigFileTest.js")
await import("./desktop/db/OfflineDbTest.js")
await import("./desktop/db/OfflineDbFacadeTest.js")
await import ("./desktop/credentials/DesktopCredentialsEncryptionTest.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({
ignoreWarnings: true
})
o.before(async function () {
// setup the Entropy for all testcases
await random.addEntropy([{data: 36, entropy: 256, source: "key"}])
})
o.afterEach(function () {
td.reset()
// Reset env.mode in case any tests have fiddled with it
env.mode = Mode.Test
})
}
export function preTest() {
if (globalThis.isBrowser) {
const p = document.createElement("p")
p.id = "report"
p.style.fontWeight = "bold"
p.style.fontSize = "30px"
p.style.fontFamily = "sans-serif"
p.textContent = "Running tests..."
neverNull(document.body).appendChild(p)
}
}
export function reportTest(results: any, stats: any) {
// @ts-ignore
const errCount = o.report(results, stats)
if (typeof process != "undefined" && errCount !== 0) process.exit(1) // eslint-disable-line no-process-exit
if (globalThis.isBrowser) {
const p = assertNotNull(document.getElementById("report"))
// errCount includes bailCount
p.textContent = errCount === 0 ? "No errors" : `${errCount} error(s) (see console)`
p.style.color = errCount === 0 ? "green" : "red"
}
}

View file

@ -1,10 +1,9 @@
import o from "ospec"
import type {BrowserData} from "../../src/misc/ClientConstants.js" import type {BrowserData} from "../../src/misc/ClientConstants.js"
import type {Db} from "../../src/api/worker/search/SearchTypes.js" import type {Db} from "../../src/api/worker/search/SearchTypes.js"
import {IndexerCore} from "../../src/api/worker/search/IndexerCore.js" import {IndexerCore} from "../../src/api/worker/search/IndexerCore.js"
import {EventQueue} from "../../src/api/worker/search/EventQueue.js" import {EventQueue} from "../../src/api/worker/search/EventQueue.js"
import {DbFacade, DbTransaction} from "../../src/api/worker/search/DbFacade.js" import {DbFacade, DbTransaction} from "../../src/api/worker/search/DbFacade.js"
import {assertNotNull, neverNull, Thunk} from "@tutao/tutanota-utils" import {Thunk} from "@tutao/tutanota-utils"
import type {DesktopKeyStoreFacade} from "../../src/desktop/KeyStoreFacadeImpl.js" import type {DesktopKeyStoreFacade} from "../../src/desktop/KeyStoreFacadeImpl.js"
import {mock} from "@tutao/tutanota-test-utils" import {mock} from "@tutao/tutanota-test-utils"
import {aes256RandomKey, fixedIv, uint8ArrayToKey} from "@tutao/tutanota-crypto" import {aes256RandomKey, fixedIv, uint8ArrayToKey} from "@tutao/tutanota-crypto"
@ -40,30 +39,6 @@ export function makeCore(args?: {
return core return core
} }
export function preTest() {
if (globalThis.isBrowser) {
const p = document.createElement("p")
p.id = "report"
p.style.fontWeight = "bold"
p.style.fontSize = "30px"
p.style.fontFamily = "sans-serif"
p.textContent = "Running tests..."
neverNull(document.body).appendChild(p)
}
}
export function reportTest(results: any, stats: any) {
// @ts-ignore
const errCount = o.report(results, stats)
if (typeof process != "undefined" && errCount !== 0) process.exit(1) // eslint-disable-line no-process-exit
if (globalThis.isBrowser) {
const p = assertNotNull(document.getElementById("report"))
// errCount includes bailCount
p.textContent = errCount === 0 ? "No errors" : `${errCount} error(s) (see console)`
p.style.color = errCount === 0 ? "green" : "red"
}
}
export function makeKeyStoreFacade(uint8ArrayKey: Uint8Array): DesktopKeyStoreFacade { export function makeKeyStoreFacade(uint8ArrayKey: Uint8Array): DesktopKeyStoreFacade {
return { return {
getDeviceKey() { getDeviceKey() {

View file

@ -20,8 +20,8 @@ import {
ConnectionError, ConnectionError,
InternalServerError, InternalServerError,
handleRestError, handleRestError,
} from "../../../src/api/common/error/RestError" } from "../../../../../src/api/common/error/RestError.js"
import {TutanotaError} from "../../../src/api/common/error/TutanotaError" import {TutanotaError} from "../../../../../src/api/common/error/TutanotaError.js"
o.spec("RestErrorTest", function () { o.spec("RestErrorTest", function () {
o("handleRestError should create the correct error classes", () => { o("handleRestError should create the correct error classes", () => {
o(handleRestError(400) instanceof BadRequestError).equals(true) o(handleRestError(400) instanceof BadRequestError).equals(true)

View file

@ -1,6 +1,6 @@
import o from "ospec" import o from "ospec"
import {ProgrammingError} from "../../../src/api/common/error/ProgrammingError" import {ProgrammingError} from "../../../../../src/api/common/error/ProgrammingError.js"
import {TutanotaError} from "../../../src/api/common/error/TutanotaError" import {TutanotaError} from "../../../../../src/api/common/error/TutanotaError.js"
o.spec("TutanotaErrorTest", function () { o.spec("TutanotaErrorTest", function () {
o("error name should be correct", () => { o("error name should be correct", () => {
o(new ProgrammingError().name).equals("ProgrammingError") o(new ProgrammingError().name).equals("ProgrammingError")

View file

@ -1,8 +1,8 @@
import o from "ospec" import o from "ospec"
import {createBirthday} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createBirthday} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {birthdayToIsoDate, isoDateToBirthday} from "../../../src/api/common/utils/BirthdayUtils" import {birthdayToIsoDate, isoDateToBirthday} from "../../../../../src/api/common/utils/BirthdayUtils.js"
import {ParsingError} from "../../../src/api/common/error/ParsingError" import {ParsingError} from "../../../../../src/api/common/error/ParsingError.js"
import {TutanotaError} from "../../../src/api/common/error/TutanotaError" import {TutanotaError} from "../../../../../src/api/common/error/TutanotaError.js"
o.spec("ContactUtilsTest", function () { o.spec("ContactUtilsTest", function () {
o("birthdayToIsoDate", function () { o("birthdayToIsoDate", function () {
const bday = createBirthday({ const bday = createBirthday({

View file

@ -4,7 +4,7 @@ import {
generatedIdToTimestamp, generatedIdToTimestamp,
timestampToGeneratedId, timestampToGeneratedId,
timestampToHexGeneratedId, timestampToHexGeneratedId,
} from "../../../src/api/common/utils/EntityUtils" } from "../../../../../src/api/common/utils/EntityUtils.js"
o.spec("EntityUtils", function () { o.spec("EntityUtils", function () {
o("TimestampToHexGeneratedId ", function () { o("TimestampToHexGeneratedId ", function () {
let timestamp = 1370563200000 let timestamp = 1370563200000

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {deduplicateFilenames, sanitizeFilename} from "../../../../src/api/common/utils/FileUtils" import {deduplicateFilenames, sanitizeFilename} from "../../../../../src/api/common/utils/FileUtils.js"
o.spec("FileUtilsTest", function () { o.spec("FileUtilsTest", function () {
o("sanitizeFilename", function () { o("sanitizeFilename", function () {

View file

@ -1,9 +1,9 @@
// @ts-nocheck // @ts-nocheck
import o from "ospec" import o from "ospec"
import {client} from "../../../src/misc/ClientDetector" import {client} from "../../../../../src/misc/ClientDetector.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {addSearchIndexDebugEntry, getSearchIndexDebugLogs} from "../../../src/misc/IndexerDebugLogger" import {addSearchIndexDebugEntry, getSearchIndexDebugLogs} from "../../../../../src/misc/IndexerDebugLogger.js"
node(() => { node(() => {
o.spec("IndexerDebugLoggerTest", function () { o.spec("IndexerDebugLoggerTest", function () {

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {LOG_SIZE, Logger} from "../../../src/api/common/Logger" import {LOG_SIZE, Logger} from "../../../../../src/api/common/Logger.js"
import {lastThrow} from "@tutao/tutanota-utils" import {lastThrow} from "@tutao/tutanota-utils"
o.spec("Loger test", function () { o.spec("Loger test", function () {
let dateProvider let dateProvider

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {_findMatches, _search, search} from "../../../src/api/common/utils/PlainTextSearch" import {_findMatches, _search, search} from "../../../../../src/api/common/utils/PlainTextSearch.js"
o.spec("PlainTextSearchTest", function () { o.spec("PlainTextSearchTest", function () {
const entryWithNestedArray1 = { const entryWithNestedArray1 = {
title: "Is my password strong enough?", title: "Is my password strong enough?",

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {EntropyCollector} from "../../../src/api/main/EntropyCollector" import {EntropyCollector} from "../../../../src/api/main/EntropyCollector.js"
import {EntropySource} from "@tutao/tutanota-crypto"; import {EntropySource} from "@tutao/tutanota-crypto";
o.spec("EntropyCollector", function () { o.spec("EntropyCollector", function () {

View file

@ -1,13 +1,13 @@
import o from "ospec" import o from "ospec"
import type {WorkerClient} from "../../../src/api/main/WorkerClient" import type {WorkerClient} from "../../../../src/api/main/WorkerClient.js"
import {CryptoError} from "../../../src/api/common/error/CryptoError" import {CryptoError} from "../../../../src/api/common/error/CryptoError.js"
import {NotAuthenticatedError} from "../../../src/api/common/error/RestError" import {NotAuthenticatedError} from "../../../../src/api/common/error/RestError.js"
import {Request} from "../../../src/api/common/MessageDispatcher" import {Request} from "../../../../src/api/common/MessageDispatcher.js"
import {ProgrammingError} from "../../../src/api/common/error/ProgrammingError" import {ProgrammingError} from "../../../../src/api/common/error/ProgrammingError.js"
import {logins} from "../../../src/api/main/LoginController" import {logins} from "../../../../src/api/main/LoginController.js"
import {locator} from "../../../src/api/main/MainLocator" import {locator} from "../../../../src/api/main/MainLocator.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {SessionType} from "../../../src/api/common/SessionType.js"; import {SessionType} from "../../../../src/api/common/SessionType.js";
o.spec( o.spec(
"WorkerTest request / response", "WorkerTest request / response",

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {compress, CompressionError, uncompress} from "../../../src/api/worker/Compression" import {compress, CompressionError, uncompress} from "../../../../src/api/worker/Compression.js"
import {stringToUtf8Uint8Array} from "@tutao/tutanota-utils" import {stringToUtf8Uint8Array} from "@tutao/tutanota-utils"
o.spec("Compression/Decompression", function () { o.spec("Compression/Decompression", function () {
const lowerBound = 12 const lowerBound = 12

View file

@ -1,29 +1,29 @@
import o from "ospec" import o from "ospec"
import {ConnectMode, EventBusClient} from "../../../src/api/worker/EventBusClient" import {ConnectMode, EventBusClient} from "../../../../src/api/worker/EventBusClient.js"
import {GroupType, OperationType} from "../../../src/api/common/TutanotaConstants" import {GroupType, OperationType} from "../../../../src/api/common/TutanotaConstants.js"
import type {EntityUpdate} from "../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityUpdate} from "../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js"
import {EntityRestClientMock} from "./EntityRestClientMock" import {EntityRestClientMock} from "./rest/EntityRestClientMock.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../../src/api/common/EntityClient.js"
import {defer, noOp} from "@tutao/tutanota-utils" import {defer, noOp} from "@tutao/tutanota-utils"
import {WorkerImpl} from "../../../src/api/worker/WorkerImpl" import {WorkerImpl} from "../../../../src/api/worker/WorkerImpl.js"
import {LoginFacadeImpl} from "../../../src/api/worker/facades/LoginFacade" import {LoginFacadeImpl} from "../../../../src/api/worker/facades/LoginFacade.js"
import {createUser, User} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser, User} from "../../../../src/api/entities/sys/TypeRefs.js"
import {createGroupMembership} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js"
import {InstanceMapper} from "../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../src/api/worker/crypto/InstanceMapper.js"
import {EntityRestCache} from "../../../src/api/worker/rest/EntityRestCache" import {EntityRestCache} from "../../../../src/api/worker/rest/EntityRestCache.js"
import {QueuedBatch} from "../../../src/api/worker/search/EventQueue" import {QueuedBatch} from "../../../../src/api/worker/search/EventQueue.js"
import {OutOfSyncError} from "../../../src/api/common/error/OutOfSyncError" import {OutOfSyncError} from "../../../../src/api/common/error/OutOfSyncError.js"
import {matchers, object, verify, when} from "testdouble" import {matchers, object, verify, when} from "testdouble"
import {MailFacade} from "../../../src/api/worker/facades/MailFacade" import {MailFacade} from "../../../../src/api/worker/facades/MailFacade.js"
import {Indexer} from "../../../src/api/worker/search/Indexer" import {Indexer} from "../../../../src/api/worker/search/Indexer.js"
import {createWebsocketEntityData, WebsocketEntityData} from "../../../src/api/entities/sys/TypeRefs.js" import {createWebsocketEntityData, WebsocketEntityData} from "../../../../src/api/entities/sys/TypeRefs.js"
import {createWebsocketCounterData, WebsocketCounterData} from "../../../src/api/entities/sys/TypeRefs.js" import {createWebsocketCounterData, WebsocketCounterData} from "../../../../src/api/entities/sys/TypeRefs.js"
import {createWebsocketCounterValue} from "../../../src/api/entities/sys/TypeRefs.js" import {createWebsocketCounterValue} from "../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityEventBatch, EntityEventBatchTypeRef} from "../../../src/api/entities/sys/TypeRefs.js" import {createEntityEventBatch, EntityEventBatchTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js"
import {getElementId} from "../../../src/api/common/utils/EntityUtils" import {getElementId} from "../../../../src/api/common/utils/EntityUtils.js"
import {SleepDetector} from "../../../src/api/worker/utils/SleepDetector" import {SleepDetector} from "../../../../src/api/worker/utils/SleepDetector.js"
import {WsConnectionState} from "../../../src/api/main/WorkerClient" import {WsConnectionState} from "../../../../src/api/main/WorkerClient.js"
o.spec("EventBusClient test", function () { o.spec("EventBusClient test", function () {
let ebc: EventBusClient let ebc: EventBusClient

View file

@ -1,8 +1,8 @@
import o from "ospec" import o from "ospec"
import {SuspensionHandler} from "../../../src/api/worker/SuspensionHandler" import {SuspensionHandler} from "../../../../src/api/worker/SuspensionHandler.js"
import {deferWithHandler, downcast} from "@tutao/tutanota-utils" import {deferWithHandler, downcast} from "@tutao/tutanota-utils"
import type {WorkerImpl} from "../../../src/api/worker/WorkerImpl" import type {WorkerImpl} from "../../../../src/api/worker/WorkerImpl.js"
import type {SystemTimeout} from "../../../src/api/common/utils/Scheduler.js" import type {SystemTimeout} from "../../../../src/api/common/utils/Scheduler.js"
o.spec("SuspensionHandler test", () => { o.spec("SuspensionHandler test", () => {
let suspensionHandler let suspensionHandler

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {urlify} from "../../../src/api/worker/Urlifier" import {urlify} from "../../../../src/api/worker/Urlifier.js"
o.spec("UrlifierTest", function () { o.spec("UrlifierTest", function () {
o(" validHtmlLinks", function () { o(" validHtmlLinks", function () {
// html links // html links

View file

@ -28,8 +28,8 @@ import {
uint8ArrayToHex, uint8ArrayToHex,
utf8Uint8ArrayToString, utf8Uint8ArrayToString,
} from "@tutao/tutanota-utils" } from "@tutao/tutanota-utils"
import {testData} from "./CompatibilityTestData" import {testData} from "./CompatibilityTestData.js"
import {uncompress} from "../../../src/api/worker/Compression" import {uncompress} from "../../../../../src/api/worker/Compression.js"
const originalRandom = random.generateRandomData const originalRandom = random.generateRandomData
o.spec("crypto compatibility", function () { o.spec("crypto compatibility", function () {
o.afterEach(function () { o.afterEach(function () {

View file

@ -9,12 +9,12 @@ import {
uint8ArrayToBase64, uint8ArrayToBase64,
utf8Uint8ArrayToString, utf8Uint8ArrayToString,
} from "@tutao/tutanota-utils" } from "@tutao/tutanota-utils"
import {CryptoFacade, CryptoFacadeImpl} from "../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade, CryptoFacadeImpl} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {ProgrammingError} from "../../../src/api/common/error/ProgrammingError" import {ProgrammingError} from "../../../../../src/api/common/error/ProgrammingError.js"
import {Cardinality, ValueType} from "../../../src/api/common/EntityConstants" import {Cardinality, ValueType} from "../../../../../src/api/common/EntityConstants.js"
import {BucketPermissionType, PermissionType} from "../../../src/api/common/TutanotaConstants" import {BucketPermissionType, PermissionType} from "../../../../../src/api/common/TutanotaConstants.js"
import type {Mail} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Mail} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import * as Contact from "../../../src/api/entities/tutanota/TypeRefs.js" import * as Contact from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import { import {
ContactTypeRef, ContactTypeRef,
createBirthday, createBirthday,
@ -22,8 +22,8 @@ import {
createContactAddress, createContactAddress,
MailAddressTypeRef, MailAddressTypeRef,
MailTypeRef MailTypeRef
} from "../../../src/api/entities/tutanota/TypeRefs.js" } from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import * as UserIdReturn from "../../../src/api/entities/sys/TypeRefs.js" import * as UserIdReturn from "../../../../../src/api/entities/sys/TypeRefs.js"
import { import {
BucketPermissionTypeRef, BucketPermissionTypeRef,
createBucket, createBucket,
@ -39,11 +39,11 @@ import {
PermissionTypeRef, PermissionTypeRef,
UpdatePermissionKeyData, UpdatePermissionKeyData,
UserIdReturnTypeRef UserIdReturnTypeRef
} from "../../../src/api/entities/sys/TypeRefs.js" } from "../../../../../src/api/entities/sys/TypeRefs.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {LoginFacadeImpl} from "../../../src/api/worker/facades/LoginFacade" import {LoginFacadeImpl} from "../../../../../src/api/worker/facades/LoginFacade.js"
import {RestClient} from "../../../src/api/worker/rest/RestClient" import {RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../../../src/api/common/EntityClient.js"
import { import {
aes128Decrypt, aes128Decrypt,
aes128Encrypt, aes128Encrypt,
@ -57,15 +57,15 @@ import {
IV_BYTE_LENGTH, IV_BYTE_LENGTH,
random random
} from "@tutao/tutanota-crypto" } from "@tutao/tutanota-crypto"
import {RsaWeb} from "../../../src/api/worker/crypto/RsaImplementation" import {RsaWeb} from "../../../../../src/api/worker/crypto/RsaImplementation.js"
import {decryptValue, encryptValue, InstanceMapper} from "../../../src/api/worker/crypto/InstanceMapper" import {decryptValue, encryptValue, InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {locator} from "../../../src/api/worker/WorkerLocator" import {locator} from "../../../../../src/api/worker/WorkerLocator.js"
import type {ModelValue} from "../../../src/api/common/EntityTypes" import type {ModelValue} from "../../../../../src/api/common/EntityTypes.js"
import {IServiceExecutor} from "../../../src/api/common/ServiceRequest" import {IServiceExecutor} from "../../../../../src/api/common/ServiceRequest.js"
import {matchers, object, verify, when} from "testdouble" import {matchers, object, verify, when} from "testdouble"
import {UpdatePermissionKeyService} from "../../../src/api/entities/sys/Services.js" import {UpdatePermissionKeyService} from "../../../../../src/api/entities/sys/Services.js"
import {getListId, isSameId} from "../../../src/api/common/utils/EntityUtils" import {getListId, isSameId} from "../../../../../src/api/common/utils/EntityUtils.js"
import {resolveTypeReference} from "../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
const rsa = new RsaWeb() const rsa = new RsaWeb()
const rsaEncrypt = rsa.encrypt const rsaEncrypt = rsa.encrypt

View file

@ -1,27 +1,27 @@
import o from "ospec" import o from "ospec"
import {BLOB_SERVICE_REST_PATH, BlobFacade} from "../../../../src/api/worker/facades/BlobFacade.js" import {BLOB_SERVICE_REST_PATH, BlobFacade} from "../../../../../src/api/worker/facades/BlobFacade.js"
import {LoginFacadeImpl} from "../../../../src/api/worker/facades/LoginFacade" import {LoginFacadeImpl} from "../../../../../src/api/worker/facades/LoginFacade.js"
import {RestClient} from "../../../../src/api/worker/rest/RestClient" import {RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
import {SuspensionHandler} from "../../../../src/api/worker/SuspensionHandler" import {SuspensionHandler} from "../../../../../src/api/worker/SuspensionHandler.js"
import {NativeFileApp} from "../../../../src/native/common/FileApp" import {NativeFileApp} from "../../../../../src/native/common/FileApp.js"
import {AesApp} from "../../../../src/native/worker/AesApp" import {AesApp} from "../../../../../src/native/worker/AesApp.js"
import {InstanceMapper} from "../../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {ArchiveDataType, MAX_BLOB_SIZE_BYTES} from "../../../../src/api/common/TutanotaConstants" import {ArchiveDataType, MAX_BLOB_SIZE_BYTES} from "../../../../../src/api/common/TutanotaConstants.js"
import {createBlob, createBlobReferenceTokenWrapper} from "../../../../src/api/entities/sys/TypeRefs.js" import {createBlob, createBlobReferenceTokenWrapper} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createFile, createMailBody} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createFile, createMailBody} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {ServiceExecutor} from "../../../../src/api/worker/rest/ServiceExecutor" import {ServiceExecutor} from "../../../../../src/api/worker/rest/ServiceExecutor.js"
import {func, instance, matchers, object, verify, when} from "testdouble" import {func, instance, matchers, object, verify, when} from "testdouble"
import {HttpMethod} from "../../../../src/api/common/EntityFunctions" import {HttpMethod} from "../../../../../src/api/common/EntityFunctions.js"
import {BlobAccessTokenService} from "../../../../src/api/entities/storage/Services" import {BlobAccessTokenService} from "../../../../../src/api/entities/storage/Services.js"
import {getElementId, getEtId, getListId} from "../../../../src/api/common/utils/EntityUtils" import {getElementId, getEtId, getListId} from "../../../../../src/api/common/utils/EntityUtils.js"
import {aes128Decrypt, aes128Encrypt, aes128RandomKey, generateIV, sha256Hash} from "@tutao/tutanota-crypto" import {aes128Decrypt, aes128Encrypt, aes128RandomKey, generateIV, sha256Hash} from "@tutao/tutanota-crypto"
import {arrayEquals, Mapper, stringToBase64, uint8ArrayToBase64} from "@tutao/tutanota-utils" import {arrayEquals, Mapper, stringToBase64, uint8ArrayToBase64} from "@tutao/tutanota-utils"
import {Mode} from "../../../../src/api/common/Env" import {Mode} from "../../../../../src/api/common/Env.js"
import {CryptoFacade} from "../../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {FileReference} from "../../../../src/api/common/utils/FileUtils" import {FileReference} from "../../../../../src/api/common/utils/FileUtils.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {ProgrammingError} from "../../../../src/api/common/error/ProgrammingError" import {ProgrammingError} from "../../../../../src/api/common/error/ProgrammingError.js"
import {ConnectionError} from "../../../../src/api/common/error/RestError" import {ConnectionError} from "../../../../../src/api/common/error/RestError.js"
import { import {
createBlobAccessTokenPostIn, createBlobAccessTokenPostIn,
createBlobAccessTokenPostOut, createBlobAccessTokenPostOut,
@ -31,8 +31,8 @@ import {
createBlobServerUrl, createBlobServerUrl,
createBlobWriteData, createBlobWriteData,
createInstanceId createInstanceId
} from "../../../../src/api/entities/storage/TypeRefs" } from "../../../../../src/api/entities/storage/TypeRefs.js"
import storageModelInfo from "../../../../src/api/entities/storage/ModelInfo" import storageModelInfo from "../../../../../src/api/entities/storage/ModelInfo.js"
const {anything, captor} = matchers const {anything, captor} = matchers

View file

@ -1,32 +1,32 @@
import o from "ospec" import o from "ospec"
import type {EventWithAlarmInfos} from "../../../../src/api/worker/facades/CalendarFacade" import type {EventWithAlarmInfos} from "../../../../../src/api/worker/facades/CalendarFacade.js"
import {CalendarFacade} from "../../../../src/api/worker/facades/CalendarFacade" import {CalendarFacade} from "../../../../../src/api/worker/facades/CalendarFacade.js"
import {EntityRestClientMock} from "../EntityRestClientMock" import {EntityRestClientMock} from "../rest/EntityRestClientMock.js"
import {EntityRestCache} from "../../../../src/api/worker/rest/EntityRestCache" import {EntityRestCache} from "../../../../../src/api/worker/rest/EntityRestCache.js"
import {downcast, isSameTypeRef, neverNull, noOp} from "@tutao/tutanota-utils" import {downcast, isSameTypeRef, neverNull, noOp} from "@tutao/tutanota-utils"
import {LoginFacadeImpl} from "../../../../src/api/worker/facades/LoginFacade" import {LoginFacadeImpl} from "../../../../../src/api/worker/facades/LoginFacade.js"
import type {UserAlarmInfo} from "../../../../src/api/entities/sys/TypeRefs.js" import type {UserAlarmInfo} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createUserAlarmInfo, UserAlarmInfoTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUserAlarmInfo, UserAlarmInfoTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createCalendarEventRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createCalendarEventRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {getElementId, getLetId, getListId} from "../../../../src/api/common/utils/EntityUtils" import {getElementId, getLetId, getListId} from "../../../../../src/api/common/utils/EntityUtils.js"
import type {AlarmInfo} from "../../../../src/api/entities/sys/TypeRefs.js" import type {AlarmInfo} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createAlarmInfo} from "../../../../src/api/entities/sys/TypeRefs.js" import {createAlarmInfo} from "../../../../../src/api/entities/sys/TypeRefs.js"
import type {CalendarEvent} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarEvent} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {CalendarEventTypeRef, createCalendarEvent} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {CalendarEventTypeRef, createCalendarEvent} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import type {User} from "../../../../src/api/entities/sys/TypeRefs.js" import type {User} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createUser} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createUserAlarmInfoListType} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUserAlarmInfoListType} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {ProgressMonitor} from "../../../../src/api/common/utils/ProgressMonitor" import {ProgressMonitor} from "../../../../../src/api/common/utils/ProgressMonitor.js"
import {createPushIdentifierList} from "../../../../src/api/entities/sys/TypeRefs.js" import {createPushIdentifierList} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {assertThrows, mockAttribute, unmockAttribute} from "@tutao/tutanota-test-utils" import {assertThrows, mockAttribute, unmockAttribute} from "@tutao/tutanota-test-utils"
import {ImportError} from "../../../../src/api/common/error/ImportError" import {ImportError} from "../../../../../src/api/common/error/ImportError.js"
import {PushIdentifierTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {PushIdentifierTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {SetupMultipleError} from "../../../../src/api/common/error/SetupMultipleError" import {SetupMultipleError} from "../../../../../src/api/common/error/SetupMultipleError.js"
import {InstanceMapper} from "../../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {GroupManagementFacadeImpl} from "../../../../src/api/worker/facades/GroupManagementFacade"; import {GroupManagementFacadeImpl} from "../../../../../src/api/worker/facades/GroupManagementFacade.js";
import {object} from "testdouble" import {object} from "testdouble"
import {IServiceExecutor} from "../../../../src/api/common/ServiceRequest" import {IServiceExecutor} from "../../../../../src/api/common/ServiceRequest.js"
import {CryptoFacade} from "../../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
o.spec("CalendarFacadeTest", async function () { o.spec("CalendarFacadeTest", async function () {

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import {ConfigurationDatabase, encryptItem} from "../../../src/api/worker/facades/ConfigurationDatabase" import {ConfigurationDatabase, encryptItem} from "../../../../../src/api/worker/facades/ConfigurationDatabase.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {DbStub} from "./search/DbStub" import {DbStub} from "../search/DbStub.js"
import {ExternalImageRule} from "../../../src/api/common/TutanotaConstants" import {ExternalImageRule} from "../../../../../src/api/common/TutanotaConstants.js"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {aes256RandomKey, IV_BYTE_LENGTH, random} from "@tutao/tutanota-crypto" import {aes256RandomKey, IV_BYTE_LENGTH, random} from "@tutao/tutanota-crypto"
o.spec("ConfigurationDbTest", function () { o.spec("ConfigurationDbTest", function () {

View file

@ -1,27 +1,27 @@
import o from "ospec" import o from "ospec"
import {LoginFacadeImpl} from "../../../../src/api/worker/facades/LoginFacade" import {LoginFacadeImpl} from "../../../../../src/api/worker/facades/LoginFacade.js"
import {RestClient} from "../../../../src/api/worker/rest/RestClient" import {RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
import {WorkerImpl} from "../../../../src/api/worker/WorkerImpl" import {WorkerImpl} from "../../../../../src/api/worker/WorkerImpl.js"
import {InstanceMapper} from "../../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {EntityClient} from "../../../../src/api/common/EntityClient" import {EntityClient} from "../../../../../src/api/common/EntityClient.js"
import {CryptoFacade, encryptString} from "../../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade, encryptString} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {LateInitializedCacheStorage} from "../../../../src/api/worker/rest/CacheStorageProxy" import {LateInitializedCacheStorage} from "../../../../../src/api/worker/rest/CacheStorageProxy.js"
import {func, instance, matchers, object, verify, when} from "testdouble" import {func, instance, matchers, object, verify, when} from "testdouble"
import {SessionType} from "../../../../src/api/common/SessionType" import {SessionType} from "../../../../../src/api/common/SessionType.js"
import {HttpMethod} from "../../../../src/api/common/EntityFunctions" import {HttpMethod} from "../../../../../src/api/common/EntityFunctions.js"
import {createCreateSessionReturn} from "../../../../src/api/entities/sys/TypeRefs.js" import {createCreateSessionReturn} from "../../../../../src/api/entities/sys/TypeRefs.js"
import type {SecondFactorAuthHandler} from "../../../../src/misc/2fa/SecondFactorHandler.js" import type {SecondFactorAuthHandler} from "../../../../../src/misc/2fa/SecondFactorHandler.js"
import {createSaltReturn} from "../../../../src/api/entities/sys/TypeRefs.js" import {createSaltReturn} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createUser, UserTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser, UserTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createAuthVerifier, encryptKey, generateKeyFromPassphrase, KeyLength, keyToBase64, sha256Hash} from "@tutao/tutanota-crypto" import {createAuthVerifier, encryptKey, generateKeyFromPassphrase, KeyLength, keyToBase64, sha256Hash} from "@tutao/tutanota-crypto"
import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createTutanotaProperties, TutanotaPropertiesTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createTutanotaProperties, TutanotaPropertiesTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {Indexer} from "../../../../src/api/worker/search/Indexer" import {Indexer} from "../../../../../src/api/worker/search/Indexer.js"
import {EventBusClient} from "../../../../src/api/worker/EventBusClient" import {EventBusClient} from "../../../../../src/api/worker/EventBusClient.js"
import {Credentials} from "../../../../src/misc/credentials/Credentials" import {Credentials} from "../../../../../src/misc/credentials/Credentials.js"
import {uint8ArrayToBase64} from "@tutao/tutanota-utils" import {uint8ArrayToBase64} from "@tutao/tutanota-utils"
import {IServiceExecutor} from "../../../../src/api/common/ServiceRequest" import {IServiceExecutor} from "../../../../../src/api/common/ServiceRequest.js"
import {SaltService, SessionService} from "../../../../src/api/entities/sys/Services.js" import {SaltService, SessionService} from "../../../../../src/api/entities/sys/Services.js"
const {anything} = matchers const {anything} = matchers

View file

@ -1,17 +1,17 @@
import o from "ospec" import o from "ospec"
import {MailFacade, phishingMarkerValue} from "../../../../src/api/worker/facades/MailFacade" import {MailFacade, phishingMarkerValue} from "../../../../../src/api/worker/facades/MailFacade.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {createMail} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMail} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailAddress} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailAddress} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {MailAuthenticationStatus, ReportedMailFieldType} from "../../../../src/api/common/TutanotaConstants" import {MailAuthenticationStatus, ReportedMailFieldType} from "../../../../../src/api/common/TutanotaConstants.js"
import {createPhishingMarker} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createPhishingMarker} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {object} from "testdouble" import {object} from "testdouble"
import {CryptoFacade} from "../../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {IServiceExecutor} from "../../../../src/api/common/ServiceRequest" import {IServiceExecutor} from "../../../../../src/api/common/ServiceRequest.js"
import {LoginFacade, LoginFacadeImpl} from "../../../../src/api/worker/facades/LoginFacade" import {LoginFacade, LoginFacadeImpl} from "../../../../../src/api/worker/facades/LoginFacade.js"
import {FileFacade} from "../../../../src/api/worker/facades/FileFacade" import {FileFacade} from "../../../../../src/api/worker/facades/FileFacade.js"
import {EntityClient} from "../../../../src/api/common/EntityClient" import {EntityClient} from "../../../../../src/api/common/EntityClient.js"
import {BlobFacade} from "../../../../src/api/worker/facades/BlobFacade" import {BlobFacade} from "../../../../../src/api/worker/facades/BlobFacade.js"
o.spec("MailFacade test", function () { o.spec("MailFacade test", function () {
let facade: MailFacade let facade: MailFacade

View file

@ -1,6 +1,6 @@
import o from "ospec" import o from "ospec"
import * as cborg from "cborg" import * as cborg from "cborg"
import {customTypeDecoders, customTypeEncoders} from "../../../src/api/worker/rest/OfflineStorage" import {customTypeDecoders, customTypeEncoders} from "../../../../../src/api/worker/rest/OfflineStorage.js"
o.spec("CborDateEncoder", function () { o.spec("CborDateEncoder", function () {
o("encode and decode date", function () { o("encode and decode date", function () {

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import {CacheStorage, EntityRestCache, expandId, EXTEND_RANGE_MIN_CHUNK_SIZE} from "../../../src/api/worker/rest/EntityRestCache" import {CacheStorage, EntityRestCache, expandId, EXTEND_RANGE_MIN_CHUNK_SIZE} from "../../../../../src/api/worker/rest/EntityRestCache.js"
import type {Mail, MailBody} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Mail, MailBody} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {ContactTypeRef, createContact, createMail, createMailBody, MailBodyTypeRef, MailTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef, createContact, createMail, createMailBody, MailBodyTypeRef, MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {OperationType} from "../../../src/api/common/TutanotaConstants" import {OperationType} from "../../../../../src/api/common/TutanotaConstants.js"
import type {EntityUpdate} from "../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import { import {
createCustomer, createCustomer,
createEntityUpdate, createEntityUpdate,
@ -12,25 +12,25 @@ import {
CustomerTypeRef, CustomerTypeRef,
ExternalUserReferenceTypeRef, ExternalUserReferenceTypeRef,
PermissionTypeRef PermissionTypeRef
} from "../../../src/api/entities/sys/TypeRefs.js" } from "../../../../../src/api/entities/sys/TypeRefs.js"
import {arrayOf, assertNotNull, clone, downcast, isSameTypeRef, neverNull, TypeRef} from "@tutao/tutanota-utils" import {arrayOf, assertNotNull, clone, downcast, isSameTypeRef, neverNull, TypeRef} from "@tutao/tutanota-utils"
import {NotAuthorizedError, NotFoundError} from "../../../src/api/common/error/RestError" import {NotAuthorizedError, NotFoundError} from "../../../../../src/api/common/error/RestError.js"
import {EntityRestClient, typeRefToPath} from "../../../src/api/worker/rest/EntityRestClient" import {EntityRestClient, typeRefToPath} from "../../../../../src/api/worker/rest/EntityRestClient.js"
import {CUSTOM_MIN_ID, GENERATED_MAX_ID, GENERATED_MIN_ID, getElementId, getListId, stringToCustomId} from "../../../src/api/common/utils/EntityUtils"; import {CUSTOM_MIN_ID, GENERATED_MAX_ID, GENERATED_MIN_ID, getElementId, getListId, stringToCustomId} from "../../../../../src/api/common/utils/EntityUtils.js";
import {assertThrows, mockAttribute, unmockAttribute} from "@tutao/tutanota-test-utils" import {assertThrows, mockAttribute, unmockAttribute} from "@tutao/tutanota-test-utils"
import {EphemeralCacheStorage} from "../../../src/api/worker/rest/EphemeralCacheStorage" import {EphemeralCacheStorage} from "../../../../../src/api/worker/rest/EphemeralCacheStorage.js"
import {QueuedBatch} from "../../../src/api/worker/search/EventQueue" import {QueuedBatch} from "../../../../../src/api/worker/search/EventQueue.js"
import {matchers, object, when} from "testdouble" import {matchers, object, when} from "testdouble"
import {OfflineStorage} from "../../../src/api/worker/rest/OfflineStorage" import {OfflineStorage} from "../../../../../src/api/worker/rest/OfflineStorage.js"
import {RestClient} from "../../../src/api/worker/rest/RestClient" import {RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
const {anything} = matchers const {anything} = matchers
const offlineDatabaseTestKey = [3957386659, 354339016, 3786337319, 3366334248] const offlineDatabaseTestKey = [3957386659, 354339016, 3786337319, 3366334248]
async function getOfflineStorage(userId: Id): Promise<CacheStorage> { async function getOfflineStorage(userId: Id): Promise<CacheStorage> {
const {OfflineDbFacade} = await import("../../../src/desktop/db/OfflineDbFacade.js") const {OfflineDbFacade} = await import("../../../../../src/desktop/db/OfflineDbFacade.js")
const {OfflineDb} = await import("../../../src/desktop/db/OfflineDb.js") const {OfflineDb} = await import("../../../../../src/desktop/db/OfflineDb.js")
const offlineDbFactory = { const offlineDbFactory = {
async create(userId: string, key) { async create(userId: string, key) {
assertNotNull(userId) assertNotNull(userId)

View file

@ -1,4 +1,4 @@
import {EntityRestClient, getIds} from "../../../src/api/worker/rest/EntityRestClient" import {EntityRestClient, getIds} from "../../../../../src/api/worker/rest/EntityRestClient.js"
import { import {
compareNewestFirst, compareNewestFirst,
compareOldestFirst, compareOldestFirst,
@ -8,12 +8,12 @@ import {
getListId, getListId,
listIdPart, listIdPart,
timestampToGeneratedId, timestampToGeneratedId,
} from "../../../src/api/common/utils/EntityUtils" } from "../../../../../src/api/common/utils/EntityUtils.js"
import {_verifyType, resolveTypeReference} from "../../../src/api/common/EntityFunctions" import {_verifyType, resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
import {NotFoundError} from "../../../src/api/common/error/RestError" import {NotFoundError} from "../../../../../src/api/common/error/RestError.js"
import {downcast, TypeRef} from "@tutao/tutanota-utils" import {downcast, TypeRef} from "@tutao/tutanota-utils"
import type {ElementEntity, ListElementEntity, SomeEntity} from "../../../src/api/common/EntityTypes" import type {ElementEntity, ListElementEntity, SomeEntity} from "../../../../../src/api/common/EntityTypes.js"
import {InstanceMapper} from "../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
export class EntityRestClientMock extends EntityRestClient { export class EntityRestClientMock extends EntityRestClient {
_entities: Record<Id, ElementEntity | Error> = {} _entities: Record<Id, ElementEntity | Error> = {}

View file

@ -1,19 +1,19 @@
import o from "ospec" import o from "ospec"
import {Contact, ContactTypeRef, createContact} from "../../../src/api/entities/tutanota/TypeRefs.js" import {Contact, ContactTypeRef, createContact} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {BadRequestError, InternalServerError, PayloadTooLargeError} from "../../../src/api/common/error/RestError" import {BadRequestError, InternalServerError, PayloadTooLargeError} from "../../../../../src/api/common/error/RestError.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {SetupMultipleError} from "../../../src/api/common/error/SetupMultipleError" import {SetupMultipleError} from "../../../../../src/api/common/error/SetupMultipleError.js"
import {HttpMethod, MediaType, resolveTypeReference} from "../../../src/api/common/EntityFunctions" import {HttpMethod, MediaType, resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
import {createCustomer, CustomerTypeRef} from "../../../src/api/entities/sys/TypeRefs.js" import {createCustomer, CustomerTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {EntityRestClient, typeRefToPath} from "../../../src/api/worker/rest/EntityRestClient" import {EntityRestClient, typeRefToPath} from "../../../../../src/api/worker/rest/EntityRestClient.js"
import {RestClient} from "../../../src/api/worker/rest/RestClient" import {RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
import type {CryptoFacade} from "../../../src/api/worker/crypto/CryptoFacade" import type {CryptoFacade} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {createInternalRecipientKeyData} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createInternalRecipientKeyData} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {InstanceMapper} from "../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {CalendarEventTypeRef} from "../../../src/api/entities/tutanota/TypeRefs.js" import {CalendarEventTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {matchers, object, verify, when} from "testdouble" import {matchers, object, verify, when} from "testdouble"
import tutanotaModelInfo from "../../../src/api/entities/tutanota/ModelInfo" import tutanotaModelInfo from "../../../../../src/api/entities/tutanota/ModelInfo.js"
import sysModelInfo from "../../../src/api/entities/sys/ModelInfo" import sysModelInfo from "../../../../../src/api/entities/sys/ModelInfo.js"
const {anything} = matchers const {anything} = matchers

View file

@ -1,10 +1,10 @@
import o from "ospec" import o from "ospec"
import {verify} from "@tutao/tutanota-test-utils" import {verify} from "@tutao/tutanota-test-utils"
import {OfflineStorage} from "../../../../src/api/worker/rest/OfflineStorage" import {OfflineStorage} from "../../../../../src/api/worker/rest/OfflineStorage.js"
import {OfflineDbFacade} from "../../../../src/desktop/db/OfflineDbFacade" import {OfflineDbFacade} from "../../../../../src/desktop/db/OfflineDbFacade.js"
import {matchers, object, when} from "testdouble" import {matchers, object, when} from "testdouble"
import * as cborg from "cborg" import * as cborg from "cborg"
import {modelInfos} from "../../../../src/api/common/EntityFunctions" import {modelInfos} from "../../../../../src/api/common/EntityFunctions.js"
o.spec("OfflineStorage", function () { o.spec("OfflineStorage", function () {
o("when initialized and runtime version matches stored one database is not purged", async function () { o("when initialized and runtime version matches stored one database is not purged", async function () {

View file

@ -1,12 +1,13 @@
import o from "ospec" import o from "ospec"
import {isSuspensionResponse, RestClient} from "../../../src/api/worker/rest/RestClient" import {isSuspensionResponse, RestClient} from "../../../../../src/api/worker/rest/RestClient.js"
import {HttpMethod, MediaType} from "../../../src/api/common/EntityFunctions" import {HttpMethod, MediaType} from "../../../../../src/api/common/EntityFunctions.js"
import {ResourceError} from "../../../src/api/common/error/RestError" import {ResourceError} from "../../../../../src/api/common/error/RestError.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import http from "http"; import http from "http";
const SERVER_TIME_IN_HEADER = "Mon, 12 Jul 2021 13:18:39 GMT" const SERVER_TIME_IN_HEADER = "Mon, 12 Jul 2021 13:18:39 GMT"
const SERVER_TIMESTAMP = 1626095919000 const SERVER_TIMESTAMP = 1626095919000
o.spec("rest client", function () { o.spec("rest client", function () {
env.staticUrl = "http://localhost:3000" env.staticUrl = "http://localhost:3000"
const suspensionHandlerMock = { const suspensionHandlerMock = {

View file

@ -1,16 +1,16 @@
import o from "ospec" import o from "ospec"
import {ServiceExecutor} from "../../../../src/api/worker/rest/ServiceExecutor.js" import {ServiceExecutor} from "../../../../../src/api/worker/rest/ServiceExecutor.js"
import {RestClient, RestClientOptions} from "../../../../src/api/worker/rest/RestClient" import {RestClient, RestClientOptions} from "../../../../../src/api/worker/rest/RestClient.js"
import {InstanceMapper} from "../../../../src/api/worker/crypto/InstanceMapper" import {InstanceMapper} from "../../../../../src/api/worker/crypto/InstanceMapper.js"
import {CryptoFacade} from "../../../../src/api/worker/crypto/CryptoFacade" import {CryptoFacade} from "../../../../../src/api/worker/crypto/CryptoFacade.js"
import {matchers, object, when} from "testdouble" import {matchers, object, when} from "testdouble"
import {DeleteService, GetService, PostService, PutService} from "../../../../src/api/common/ServiceRequest" import {DeleteService, GetService, PostService, PutService} from "../../../../../src/api/common/ServiceRequest.js"
import {createSaltData, SaltDataTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createSaltData, SaltDataTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {HttpMethod, MediaType, resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {HttpMethod, MediaType, resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
import {deepEqual} from "@tutao/tutanota-utils" import {deepEqual} from "@tutao/tutanota-utils"
import {assertThrows, verify} from "@tutao/tutanota-test-utils" import {assertThrows, verify} from "@tutao/tutanota-test-utils"
import {createGiftCardCreateData, GiftCardCreateDataTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGiftCardCreateData, GiftCardCreateDataTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {ProgrammingError} from "../../../../src/api/common/error/ProgrammingError" import {ProgrammingError} from "../../../../../src/api/common/error/ProgrammingError.js"
const {anything} = matchers const {anything} = matchers

View file

@ -1,23 +1,23 @@
import o from "ospec" import o from "ospec"
import {ContactTypeRef, createContact} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef, createContact} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {ContactIndexer} from "../../../../src/api/worker/search/ContactIndexer" import {ContactIndexer} from "../../../../../src/api/worker/search/ContactIndexer.js"
import {createContactAddress} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createContactAddress} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createContactMailAddress} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createContactMailAddress} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createContactPhoneNumber} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createContactPhoneNumber} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createContactSocialId} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createContactSocialId} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {NotAuthorizedError, NotFoundError} from "../../../../src/api/common/error/RestError" import {NotAuthorizedError, NotFoundError} from "../../../../../src/api/common/error/RestError.js"
import {ContactListTypeRef, createContactList} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactListTypeRef, createContactList} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {DbTransaction} from "../../../../src/api/worker/search/DbFacade" import {DbTransaction} from "../../../../../src/api/worker/search/DbFacade.js"
import {FULL_INDEXED_TIMESTAMP, NOTHING_INDEXED_TIMESTAMP, OperationType} from "../../../../src/api/common/TutanotaConstants" import {FULL_INDEXED_TIMESTAMP, NOTHING_INDEXED_TIMESTAMP, OperationType} from "../../../../../src/api/common/TutanotaConstants.js"
import {_createNewIndexUpdate, encryptIndexKeyBase64, typeRefToTypeInfo} from "../../../../src/api/worker/search/IndexUtils" import {_createNewIndexUpdate, encryptIndexKeyBase64, typeRefToTypeInfo} from "../../../../../src/api/worker/search/IndexUtils.js"
import type {EntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {makeCore} from "../../TestUtils" import {makeCore} from "../../../TestUtils.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {isSameId} from "../../../../src/api/common/utils/EntityUtils"; import {isSameId} from "../../../../../src/api/common/utils/EntityUtils.js";
import {GroupDataOS} from "../../../../src/api/worker/search/Indexer" import {GroupDataOS} from "../../../../../src/api/worker/search/Indexer.js"
import {fixedIv} from "@tutao/tutanota-crypto" import {fixedIv} from "@tutao/tutanota-crypto"
import {resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
const dbMock: any = {iv: fixedIv} const dbMock: any = {iv: fixedIv}

View file

@ -1,7 +1,7 @@
import type {DbKey, ObjectStoreName} from "../../../../src/api/worker/search/DbFacade" import type {DbKey, ObjectStoreName} from "../../../../../src/api/worker/search/DbFacade.js"
import {DbTransaction, osName} from "../../../../src/api/worker/search/DbFacade" import {DbTransaction, osName} from "../../../../../src/api/worker/search/DbFacade.js"
import {downcast, neverNull} from "@tutao/tutanota-utils" import {downcast, neverNull} from "@tutao/tutanota-utils"
import type {IndexName} from "../../../../src/api/worker/search/Indexer"; import type {IndexName} from "../../../../../src/api/worker/search/Indexer.js";
import { import {
ElementDataOS, ElementDataOS,
GroupDataOS, GroupDataOS,
@ -9,7 +9,7 @@ import {
SearchIndexMetaDataOS, SearchIndexMetaDataOS,
SearchIndexOS, SearchIndexOS,
SearchIndexWordsIndex SearchIndexWordsIndex
} from "../../../../src/api/worker/search/Indexer"; } from "../../../../../src/api/worker/search/Indexer.js";
export type Index = { [indexName: string]: string } export type Index = { [indexName: string]: string }

View file

@ -1,12 +1,12 @@
import o from "ospec" import o from "ospec"
import type {QueuedBatch} from "../../../../src/api/worker/search/EventQueue" import type {QueuedBatch} from "../../../../../src/api/worker/search/EventQueue.js"
import {EventQueue} from "../../../../src/api/worker/search/EventQueue" import {EventQueue} from "../../../../../src/api/worker/search/EventQueue.js"
import type {EntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {OperationType} from "../../../../src/api/common/TutanotaConstants" import {OperationType} from "../../../../../src/api/common/TutanotaConstants.js"
import {defer} from "@tutao/tutanota-utils" import {defer} from "@tutao/tutanota-utils"
import {ConnectionError} from "../../../../src/api/common/error/RestError" import {ConnectionError} from "../../../../../src/api/common/error/RestError.js"
import {MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {delay} from "@tutao/tutanota-utils" import {delay} from "@tutao/tutanota-utils"
o.spec("EventQueueTest", function () { o.spec("EventQueueTest", function () {

View file

@ -1,22 +1,22 @@
import o from "ospec" import o from "ospec"
import {createGroupInfo, GroupInfoTypeRef,} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupInfo, GroupInfoTypeRef,} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {NotFoundError} from "../../../../src/api/common/error/RestError" import {NotFoundError} from "../../../../../src/api/common/error/RestError.js"
import type {Db} from "../../../../src/api/worker/search/SearchTypes" import type {Db} from "../../../../../src/api/worker/search/SearchTypes.js"
import {FULL_INDEXED_TIMESTAMP, GroupType, NOTHING_INDEXED_TIMESTAMP, OperationType,} from "../../../../src/api/common/TutanotaConstants" import {FULL_INDEXED_TIMESTAMP, GroupType, NOTHING_INDEXED_TIMESTAMP, OperationType,} from "../../../../../src/api/common/TutanotaConstants.js"
import {IndexerCore} from "../../../../src/api/worker/search/IndexerCore" import {IndexerCore} from "../../../../../src/api/worker/search/IndexerCore.js"
import {_createNewIndexUpdate, encryptIndexKeyBase64, typeRefToTypeInfo,} from "../../../../src/api/worker/search/IndexUtils" import {_createNewIndexUpdate, encryptIndexKeyBase64, typeRefToTypeInfo,} from "../../../../../src/api/worker/search/IndexUtils.js"
import {GroupInfoIndexer} from "../../../../src/api/worker/search/GroupInfoIndexer" import {GroupInfoIndexer} from "../../../../../src/api/worker/search/GroupInfoIndexer.js"
import {createMailAddressAlias} from "../../../../src/api/entities/sys/TypeRefs.js" import {createMailAddressAlias} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createUser} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createCustomer, CustomerTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createCustomer, CustomerTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../../src/api/entities/sys/TypeRefs.js"
import type {EntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {browserDataStub} from "../../TestUtils" import {browserDataStub} from "../../../TestUtils.js"
import {isSameId} from "../../../../src/api/common/utils/EntityUtils" import {isSameId} from "../../../../../src/api/common/utils/EntityUtils.js"
import {GroupDataOS} from "../../../../src/api/worker/search/Indexer" import {GroupDataOS} from "../../../../../src/api/worker/search/Indexer.js"
import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto" import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto"
import {resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
const dbMock: any = { const dbMock: any = {
iv: fixedIv, iv: fixedIv,

View file

@ -13,21 +13,21 @@ import {
typeRefToTypeInfo, typeRefToTypeInfo,
userIsGlobalAdmin, userIsGlobalAdmin,
userIsLocalOrGlobalAdmin, userIsLocalOrGlobalAdmin,
} from "../../../../src/api/worker/search/IndexUtils" } from "../../../../../src/api/worker/search/IndexUtils.js"
import {base64ToUint8Array, utf8Uint8ArrayToString} from "@tutao/tutanota-utils" import {base64ToUint8Array, utf8Uint8ArrayToString} from "@tutao/tutanota-utils"
import {concat} from "@tutao/tutanota-utils" import {concat} from "@tutao/tutanota-utils"
import type {SearchIndexEntry, SearchIndexMetaDataRow} from "../../../../src/api/worker/search/SearchTypes" import type {SearchIndexEntry, SearchIndexMetaDataRow} from "../../../../../src/api/worker/search/SearchTypes.js"
import {createUser, UserTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser, UserTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {GroupType, OperationType} from "../../../../src/api/common/TutanotaConstants" import {GroupType, OperationType} from "../../../../../src/api/common/TutanotaConstants.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {containsEventOfType} from "../../../../src/api/common/utils/Utils" import {containsEventOfType} from "../../../../../src/api/common/utils/Utils.js"
import {MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {byteLength} from "@tutao/tutanota-utils" import {byteLength} from "@tutao/tutanota-utils"
import {aes256Decrypt, aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto" import {aes256Decrypt, aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto"
import {EntityUpdateData} from "../../../../src/api/main/EventController"; import {EntityUpdateData} from "../../../../../src/api/main/EventController.js";
import {resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
o.spec("Index Utils", () => { o.spec("Index Utils", () => {
o("encryptIndexKey", function () { o("encryptIndexKey", function () {
let key = aes256RandomKey() let key = aes256RandomKey()

View file

@ -9,7 +9,7 @@ import type {
IndexUpdate, IndexUpdate,
SearchIndexEntry, SearchIndexEntry,
SearchIndexMetaDataRow, SearchIndexMetaDataRow,
} from "../../../../src/api/worker/search/SearchTypes" } from "../../../../../src/api/worker/search/SearchTypes.js"
import { import {
_createNewIndexUpdate, _createNewIndexUpdate,
decryptIndexKey, decryptIndexKey,
@ -20,23 +20,23 @@ import {
encryptMetaData, encryptMetaData,
getIdFromEncSearchIndexEntry, getIdFromEncSearchIndexEntry,
typeRefToTypeInfo, typeRefToTypeInfo,
} from "../../../../src/api/worker/search/IndexUtils" } from "../../../../../src/api/worker/search/IndexUtils.js"
import {base64ToUint8Array, concat, defer, downcast, neverNull, noOp, PromisableWrapper, uint8ArrayToBase64,} from "@tutao/tutanota-utils" import {base64ToUint8Array, concat, defer, downcast, neverNull, noOp, PromisableWrapper, uint8ArrayToBase64,} from "@tutao/tutanota-utils"
import {spy} from "@tutao/tutanota-test-utils" import {spy} from "@tutao/tutanota-test-utils"
import {MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {DbTransaction} from "../../../../src/api/worker/search/DbFacade" import {DbTransaction} from "../../../../../src/api/worker/search/DbFacade.js"
import {appendBinaryBlocks} from "../../../../src/api/worker/search/SearchIndexEncoding" import {appendBinaryBlocks} from "../../../../../src/api/worker/search/SearchIndexEncoding.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {EventQueue} from "../../../../src/api/worker/search/EventQueue" import {EventQueue} from "../../../../../src/api/worker/search/EventQueue.js"
import {CancelledError} from "../../../../src/api/common/error/CancelledError" import {CancelledError} from "../../../../../src/api/common/error/CancelledError.js"
import {createSearchIndexDbStub, DbStub, DbStubTransaction} from "./DbStub" import {createSearchIndexDbStub, DbStub, DbStubTransaction} from "./DbStub.js"
import {IndexerCore} from "../../../../src/api/worker/search/IndexerCore" import {IndexerCore} from "../../../../../src/api/worker/search/IndexerCore.js"
import {ContactTypeRef, createContact} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef, createContact} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {elementIdPart, generatedIdToTimestamp, listIdPart, timestampToGeneratedId,} from "../../../../src/api/common/utils/EntityUtils" import {elementIdPart, generatedIdToTimestamp, listIdPart, timestampToGeneratedId,} from "../../../../../src/api/common/utils/EntityUtils.js"
import {ElementDataOS, GroupDataOS, SearchIndexMetaDataOS, SearchIndexOS,} from "../../../../src/api/worker/search/Indexer" import {ElementDataOS, GroupDataOS, SearchIndexMetaDataOS, SearchIndexOS,} from "../../../../../src/api/worker/search/Indexer.js"
import {makeCore} from "../../TestUtils" import {makeCore} from "../../../TestUtils.js"
import {aes256Decrypt, aes256Encrypt, aes256RandomKey, fixedIv, IV_BYTE_LENGTH, random} from "@tutao/tutanota-crypto" import {aes256Decrypt, aes256Encrypt, aes256RandomKey, fixedIv, IV_BYTE_LENGTH, random} from "@tutao/tutanota-crypto"
import {resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
const mailTypeInfo = typeRefToTypeInfo(MailTypeRef) const mailTypeInfo = typeRefToTypeInfo(MailTypeRef)
const contactTypeInfo = typeRefToTypeInfo(ContactTypeRef) const contactTypeInfo = typeRefToTypeInfo(ContactTypeRef)

View file

@ -1,25 +1,25 @@
import {createUser, UserTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser, UserTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {DbTransaction} from "../../../../src/api/worker/search/DbFacade" import {DbTransaction} from "../../../../../src/api/worker/search/DbFacade.js"
import {ENTITY_EVENT_BATCH_TTL_DAYS, GroupType, NOTHING_INDEXED_TIMESTAMP, OperationType,} from "../../../../src/api/common/TutanotaConstants" import {ENTITY_EVENT_BATCH_TTL_DAYS, GroupType, NOTHING_INDEXED_TIMESTAMP, OperationType,} from "../../../../../src/api/common/TutanotaConstants.js"
import {GroupDataOS, Indexer, Metadata, MetaDataOS} from "../../../../src/api/worker/search/Indexer" import {GroupDataOS, Indexer, Metadata, MetaDataOS} from "../../../../../src/api/worker/search/Indexer.js"
import {createEntityEventBatch, EntityEventBatchTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityEventBatch, EntityEventBatchTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {NotAuthorizedError} from "../../../../src/api/common/error/RestError" import {NotAuthorizedError} from "../../../../../src/api/common/error/RestError.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {GroupInfoTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {GroupInfoTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {OutOfSyncError} from "../../../../src/api/common/error/OutOfSyncError" import {OutOfSyncError} from "../../../../../src/api/common/error/OutOfSyncError.js"
import {assertThrows, mock, spy} from "@tutao/tutanota-test-utils" import {assertThrows, mock, spy} from "@tutao/tutanota-test-utils"
import {browserDataStub} from "../../TestUtils" import {browserDataStub} from "../../../TestUtils.js"
import type {QueuedBatch} from "../../../../src/api/worker/search/EventQueue" import type {QueuedBatch} from "../../../../../src/api/worker/search/EventQueue.js"
import {EntityRestClient} from "../../../../src/api/worker/rest/EntityRestClient" import {EntityRestClient} from "../../../../../src/api/worker/rest/EntityRestClient.js"
import {MembershipRemovedError} from "../../../../src/api/common/error/MembershipRemovedError" import {MembershipRemovedError} from "../../../../../src/api/common/error/MembershipRemovedError.js"
import {WhitelabelChildTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {WhitelabelChildTypeRef} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {GENERATED_MAX_ID, generatedIdToTimestamp, getElementId, timestampToGeneratedId,} from "../../../../src/api/common/utils/EntityUtils" import {GENERATED_MAX_ID, generatedIdToTimestamp, getElementId, timestampToGeneratedId,} from "../../../../../src/api/common/utils/EntityUtils.js"
import {daysToMillis, defer, downcast, TypeRef} from "@tutao/tutanota-utils" import {daysToMillis, defer, downcast, TypeRef} from "@tutao/tutanota-utils"
import {aes128RandomKey, aes256Encrypt, aes256RandomKey, decrypt256Key, encrypt256Key, fixedIv, IV_BYTE_LENGTH, random,} from "@tutao/tutanota-crypto" import {aes128RandomKey, aes256Encrypt, aes256RandomKey, decrypt256Key, encrypt256Key, fixedIv, IV_BYTE_LENGTH, random,} from "@tutao/tutanota-crypto"
import {EntityRestCache} from "../../../../src/api/worker/rest/EntityRestCache" import {EntityRestCache} from "../../../../../src/api/worker/rest/EntityRestCache.js"
import o from "ospec" import o from "ospec"
const SERVER_TIME = new Date("1994-06-08").getTime() const SERVER_TIME = new Date("1994-06-08").getTime()

View file

@ -1,56 +1,56 @@
import o from "ospec" import o from "ospec"
import {NotAuthorizedError} from "../../../../src/api/common/error/RestError" import {NotAuthorizedError} from "../../../../../src/api/common/error/RestError.js"
import type {Db, ElementDataDbRow, IndexUpdate} from "../../../../src/api/worker/search/SearchTypes" import type {Db, ElementDataDbRow, IndexUpdate} from "../../../../../src/api/worker/search/SearchTypes.js"
import { import {
_createNewIndexUpdate, _createNewIndexUpdate,
encryptIndexKeyBase64, encryptIndexKeyBase64,
typeRefToTypeInfo, typeRefToTypeInfo,
} from "../../../../src/api/worker/search/IndexUtils" } from "../../../../../src/api/worker/search/IndexUtils.js"
import { import {
FULL_INDEXED_TIMESTAMP, FULL_INDEXED_TIMESTAMP,
GroupType, GroupType,
MailState, MailState,
NOTHING_INDEXED_TIMESTAMP, NOTHING_INDEXED_TIMESTAMP,
OperationType, OperationType,
} from "../../../../src/api/common/TutanotaConstants" } from "../../../../../src/api/common/TutanotaConstants.js"
import {IndexerCore} from "../../../../src/api/worker/search/IndexerCore" import {IndexerCore} from "../../../../../src/api/worker/search/IndexerCore.js"
import {createUser} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createGroupMembership} from "../../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../../../src/api/entities/sys/TypeRefs.js"
import { import {
_getCurrentIndexTimestamp, _getCurrentIndexTimestamp,
INITIAL_MAIL_INDEX_INTERVAL_DAYS, INITIAL_MAIL_INDEX_INTERVAL_DAYS,
MailIndexer, MailIndexer,
} from "../../../../src/api/worker/search/MailIndexer" } from "../../../../../src/api/worker/search/MailIndexer.js"
import type {Mail} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {Mail} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMail, MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMail, MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import type {MailBody} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {MailBody} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailBody} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailBody} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import type {File as TutanotaFile} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {File as TutanotaFile} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createFile} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createFile} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailAddress} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailAddress} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createEncryptedMailAddress} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createEncryptedMailAddress} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {ElementDataOS, GroupDataOS, Metadata as MetaData, MetaDataOS} from "../../../../src/api/worker/search/Indexer" import {ElementDataOS, GroupDataOS, Metadata as MetaData, MetaDataOS} from "../../../../../src/api/worker/search/Indexer.js"
import type {MailFolder} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {MailFolder} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailFolder} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailFolder} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import type {EntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import type {EntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {createEntityUpdate} from "../../../../src/api/entities/sys/TypeRefs.js" import {createEntityUpdate} from "../../../../../src/api/entities/sys/TypeRefs.js"
import {mock, spy} from "@tutao/tutanota-test-utils" import {mock, spy} from "@tutao/tutanota-test-utils"
import {browserDataStub, makeCore} from "../../TestUtils" import {browserDataStub, makeCore} from "../../../TestUtils.js"
import {downcast, getDayShifted, getStartOfDay, neverNull} from "@tutao/tutanota-utils" import {downcast, getDayShifted, getStartOfDay, neverNull} from "@tutao/tutanota-utils"
import {EventQueue} from "../../../../src/api/worker/search/EventQueue" import {EventQueue} from "../../../../../src/api/worker/search/EventQueue.js"
import {createMailboxGroupRoot} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailboxGroupRoot} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import type {MailBox} from "../../../../src/api/entities/tutanota/TypeRefs.js" import type {MailBox} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailBox} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailBox} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createSearchIndexDbStub} from "./DbStub" import {createSearchIndexDbStub} from "./DbStub.js"
import {WorkerImpl} from "../../../../src/api/worker/WorkerImpl" import {WorkerImpl} from "../../../../../src/api/worker/WorkerImpl.js"
import {getElementId, getListId, timestampToGeneratedId} from "../../../../src/api/common/utils/EntityUtils" import {getElementId, getListId, timestampToGeneratedId} from "../../../../../src/api/common/utils/EntityUtils.js"
import {createMailFolderRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMailFolderRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {EntityRestClientMock} from "../EntityRestClientMock" import {EntityRestClientMock} from "../rest/EntityRestClientMock.js"
import type {DateProvider} from "../../../../src/api/worker/DateProvider" import type {DateProvider} from "../../../../../src/api/worker/DateProvider.js"
import {LocalTimeDateProvider} from "../../../../src/api/worker/DateProvider" import {LocalTimeDateProvider} from "../../../../../src/api/worker/DateProvider.js"
import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto" import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto"
import {EntityRestCache} from "../../../../src/api/worker/rest/EntityRestCache" import {EntityRestCache} from "../../../../../src/api/worker/rest/EntityRestCache.js"
import {resolveTypeReference} from "../../../../src/api/common/EntityFunctions" import {resolveTypeReference} from "../../../../../src/api/common/EntityFunctions.js"
class FixedDateProvider implements DateProvider { class FixedDateProvider implements DateProvider {
now: number now: number

View file

@ -1,22 +1,22 @@
import o from "ospec" import o from "ospec"
import {SearchFacade} from "../../../../src/api/worker/search/SearchFacade" import {SearchFacade} from "../../../../../src/api/worker/search/SearchFacade.js"
import {MailTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {MailTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {createUser} from "../../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../../../src/api/entities/sys/TypeRefs.js"
import type {TypeInfo} from "../../../../src/api/worker/search/IndexUtils" import type {TypeInfo} from "../../../../../src/api/worker/search/IndexUtils.js"
import { import {
encryptIndexKeyBase64, encryptIndexKeyBase64,
encryptIndexKeyUint8Array, encryptIndexKeyUint8Array,
encryptMetaData, encryptMetaData,
encryptSearchIndexEntry, encryptSearchIndexEntry,
typeRefToTypeInfo, typeRefToTypeInfo,
} from "../../../../src/api/worker/search/IndexUtils" } from "../../../../../src/api/worker/search/IndexUtils.js"
import type { import type {
ElementDataDbRow, ElementDataDbRow,
SearchIndexEntry, SearchIndexEntry,
SearchIndexMetaDataRow, SearchIndexMetaDataRow,
SearchRestriction, SearchRestriction,
} from "../../../../src/api/worker/search/SearchTypes" } from "../../../../../src/api/worker/search/SearchTypes.js"
import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import { import {
compareOldestFirst, compareOldestFirst,
elementIdPart, elementIdPart,
@ -24,14 +24,14 @@ import {
generatedIdToTimestamp, generatedIdToTimestamp,
listIdPart, listIdPart,
timestampToGeneratedId, timestampToGeneratedId,
} from "../../../../src/api/common/utils/EntityUtils" } from "../../../../../src/api/common/utils/EntityUtils.js"
import {downcast, groupBy, numberRange, splitInChunks} from "@tutao/tutanota-utils" import {downcast, groupBy, numberRange, splitInChunks} from "@tutao/tutanota-utils"
import {appendBinaryBlocks} from "../../../../src/api/worker/search/SearchIndexEncoding" import {appendBinaryBlocks} from "../../../../../src/api/worker/search/SearchIndexEncoding.js"
import {createSearchIndexDbStub, DbStub, DbStubTransaction} from "./DbStub" import {createSearchIndexDbStub, DbStub, DbStubTransaction} from "./DbStub.js"
import type {BrowserData} from "../../../../src/misc/ClientConstants" import type {BrowserData} from "../../../../../src/misc/ClientConstants.js"
import {browserDataStub} from "../../TestUtils" import {browserDataStub} from "../../../TestUtils.js"
import {ElementDataOS, SearchIndexMetaDataOS, SearchIndexOS} from "../../../../src/api/worker/search/Indexer" import {ElementDataOS, SearchIndexMetaDataOS, SearchIndexOS} from "../../../../../src/api/worker/search/Indexer.js"
import type {Base64} from "@tutao/tutanota-utils/" import type {Base64} from "@tutao/tutanota-utils"
import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto" import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto"
type SearchIndexEntryWithType = SearchIndexEntry & { type SearchIndexEntryWithType = SearchIndexEntry & {
typeInfo: TypeInfo typeInfo: TypeInfo

View file

@ -8,7 +8,7 @@ import {
iterateBinaryBlocks, iterateBinaryBlocks,
numberOfBytes, numberOfBytes,
removeBinaryBlockRanges, removeBinaryBlockRanges,
} from "../../../../src/api/worker/search/SearchIndexEncoding" } from "../../../../../src/api/worker/search/SearchIndexEncoding.js"
import {spy as makeSpy} from "@tutao/tutanota-test-utils" import {spy as makeSpy} from "@tutao/tutanota-test-utils"
import {concat, flat} from "@tutao/tutanota-utils" import {concat, flat} from "@tutao/tutanota-utils"
o.spec("SearchIndexEncoding test", function () { o.spec("SearchIndexEncoding test", function () {

View file

@ -2,9 +2,9 @@
* Created by bdeterding on 13.12.17. * Created by bdeterding on 13.12.17.
*/ */
import o from "ospec" import o from "ospec"
import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef} from "../../../../../src/api/entities/tutanota/TypeRefs.js"
import {SuggestionFacade} from "../../../../src/api/worker/search/SuggestionFacade" import {SuggestionFacade} from "../../../../../src/api/worker/search/SuggestionFacade.js"
import {SearchTermSuggestionsOS} from "../../../../src/api/worker/search/Indexer" import {SearchTermSuggestionsOS} from "../../../../../src/api/worker/search/Indexer.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto" import {aes256RandomKey, fixedIv} from "@tutao/tutanota-crypto"
o.spec("SuggestionFacade test", () => { o.spec("SuggestionFacade test", () => {

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {tokenize} from "../../../../src/api/worker/search/Tokenizer" import {tokenize} from "../../../../../src/api/worker/search/Tokenizer.js"
o.spec("Tokenizer test", () => { o.spec("Tokenizer test", () => {
o("tokenize", () => { o("tokenize", () => {
o(tokenize("")).deepEquals([]) o(tokenize("")).deepEquals([])

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import {CHECK_INTERVAL, SLEEP_INTERVAL, SleepDetector} from "../../../../src/api/worker/utils/SleepDetector.js" import {CHECK_INTERVAL, SLEEP_INTERVAL, SleepDetector} from "../../../../../src/api/worker/utils/SleepDetector.js"
import {SchedulerMock} from "../../TestUtils.js" import {SchedulerMock} from "../../../TestUtils.js"
import {func, object, verify, when} from "testdouble" import {func, object, verify, when} from "testdouble"
import {assertNotNull} from "@tutao/tutanota-utils" import {assertNotNull} from "@tutao/tutanota-utils"
import {DateProvider} from "../../../../src/api/common/DateProvider.js" import {DateProvider} from "../../../../../src/api/common/DateProvider.js"
o.spec("SleepDetector", function () { o.spec("SleepDetector", function () {
let scheduler: SchedulerMock let scheduler: SchedulerMock

View file

@ -0,0 +1,98 @@
// @ts-nocheck
globalThis.isBrowser = typeof window !== "undefined"
globalThis.mocks = {}
;(async function () {
if (globalThis.isBrowser) {
await setupBrowser()
} else {
await setupNode()
}
window.tutao = {
appState: {
prefixWithoutFile: "./"
}
}
import('../tests/Suite.js')
})()
const noOp = () => {
}
function setupBrowser() {
/**
* runs this test exclusively on browsers (not nodec)
*/
window.browser = (func) => func
/**
* runs this test exclusively on node (not browsers)
*/
window.node = () => noOp
}
async function setupNode() {
/**
* runs this test exclusively on browsers (not node)
*/
globalThis.browser = () => noOp
/**
* runs this test exclusively on node (not browsers)
*/
globalThis.node = (func) => func
const browserMock = await import("mithril/test-utils/browserMock.js")
globalThis.window = browserMock.default()
globalThis.window.getElementsByTagName = function () {
} // for styles.js
globalThis.window.location = {hostname: "tutanota.com", search: "", href: "http://tutanota.com"}
globalThis.window.document.addEventListener = function () {
}
globalThis.document = globalThis.window.document
globalThis.navigator = globalThis.window.navigator
const local = {}
globalThis.localStorage = {
getItem: key => local[key],
setItem: (key, value) => local[key] = value
}
globalThis.requestAnimationFrame = globalThis.requestAnimationFrame || (callback => setTimeout(callback, 10))
globalThis.btoa = str => Buffer.from(str, 'binary').toString('base64')
globalThis.atob = b64Encoded => Buffer.from(b64Encoded, 'base64').toString('binary')
globalThis.WebSocket = noOp
const nowOffset = Date.now();
globalThis.performance = {
now: function () {
return Date.now() - nowOffset;
}
}
globalThis.performance = {
now: Date.now,
mark: noOp,
measure: noOp,
}
const crypto = await import("crypto")
globalThis.crypto = {
getRandomValues: function (bytes) {
let randomBytes = crypto.randomBytes(bytes.length)
bytes.set(randomBytes)
}
}
window.crypto = globalThis.crypto
globalThis.XMLHttpRequest = (await import("xhr2")).default
process.on("unhandledRejection", function (e) {
console.log("Uncaught (in promise) " + e.stack)
})
globalThis.electronMock = {
app: {}
}
globalThis.XMLHttpRequest = (await import("xhr2")).default
globalThis.express = (await import("express")).default
globalThis.bodyParser = (await import("body-parser")).default
}

View file

@ -1,11 +1,11 @@
import {AlarmScheduler, AlarmSchedulerImpl} from "../../../src/calendar/date/AlarmScheduler" import {AlarmScheduler, AlarmSchedulerImpl} from "../../../src/calendar/date/AlarmScheduler.js"
import o from "ospec" import o from "ospec"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js" import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js"
import {EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants" import {EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants.js"
import {DateProvider} from "../../../src/api/common/DateProvider" import {DateProvider} from "../../../src/api/common/DateProvider.js"
import {SchedulerMock} from "../../api/TestUtils" import {SchedulerMock} from "../TestUtils.js"
o.spec("AlarmScheduler", function () { o.spec("AlarmScheduler", function () {
let alarmScheduler: AlarmSchedulerImpl let alarmScheduler: AlarmSchedulerImpl

View file

@ -1,13 +1,13 @@
import o from "ospec" import o from "ospec"
// @ts-ignore[untyped-import] // @ts-ignore[untyped-import]
import en from "../../../src/translations/en" import en from "../../../src/translations/en.js"
import type {Guest} from "../../../src/calendar/date/CalendarEventViewModel" import type {Guest} from "../../../src/calendar/date/CalendarEventViewModel.js"
import {CalendarEventViewModel} from "../../../src/calendar/date/CalendarEventViewModel" import {CalendarEventViewModel} from "../../../src/calendar/date/CalendarEventViewModel.js"
import {lang} from "../../../src/misc/LanguageViewModel" import {lang} from "../../../src/misc/LanguageViewModel.js"
import {assertThrows, unmockAttribute} from "@tutao/tutanota-test-utils" import {assertThrows, unmockAttribute} from "@tutao/tutanota-test-utils"
import {clone, delay, downcast, neverNull, noOp} from "@tutao/tutanota-utils" import {clone, delay, downcast, neverNull, noOp} from "@tutao/tutanota-utils"
import type {MailboxDetail} from "../../../src/mail/model/MailModel" import type {MailboxDetail} from "../../../src/mail/model/MailModel.js"
import {MailModel} from "../../../src/mail/model/MailModel" import {MailModel} from "../../../src/mail/model/MailModel.js"
import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import { import {
@ -16,32 +16,32 @@ import {
assertEnumValue, assertEnumValue,
CalendarAttendeeStatus, CalendarAttendeeStatus,
ShareCapability, ShareCapability,
} from "../../../src/api/common/TutanotaConstants" } from "../../../src/api/common/TutanotaConstants.js"
import {createGroupMembership} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../src/api/entities/sys/TypeRefs.js"
import type {User} from "../../../src/api/entities/sys/TypeRefs.js" import type {User} from "../../../src/api/entities/sys/TypeRefs.js"
import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js"
import type {CalendarUpdateDistributor} from "../../../src/calendar/date/CalendarUpdateDistributor" import type {CalendarUpdateDistributor} from "../../../src/calendar/date/CalendarUpdateDistributor.js"
import type {IUserController} from "../../../src/api/main/UserController" import type {IUserController} from "../../../src/api/main/UserController.js"
import {createEncryptedMailAddress, EncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createEncryptedMailAddress, EncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import type {CalendarInfo} from "../../../src/calendar/model/CalendarModel" import type {CalendarInfo} from "../../../src/calendar/model/CalendarModel.js"
import {CalendarModel} from "../../../src/calendar/model/CalendarModel" import {CalendarModel} from "../../../src/calendar/model/CalendarModel.js"
import {getAllDayDateUTCFromZone, getTimeZone} from "../../../src/calendar/date/CalendarUtils" import {getAllDayDateUTCFromZone, getTimeZone} from "../../../src/calendar/date/CalendarUtils.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {RecipientInfoType} from "../../../src/api/common/RecipientInfo" import {RecipientInfoType} from "../../../src/api/common/RecipientInfo.js"
import {SendMailModel} from "../../../src/mail/editor/SendMailModel" import {SendMailModel} from "../../../src/mail/editor/SendMailModel.js"
import type {LoginController} from "../../../src/api/main/LoginController" import type {LoginController} from "../../../src/api/main/LoginController.js"
import type {ContactModel} from "../../../src/contacts/model/ContactModel" import type {ContactModel} from "../../../src/contacts/model/ContactModel.js"
import {EventController} from "../../../src/api/main/EventController" import {EventController} from "../../../src/api/main/EventController.js"
import type {Mail} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Mail} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createMail} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createMail} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createContact} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContact} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../src/api/common/EntityClient.js"
import {createPublicKeyReturn} from "../../../src/api/entities/sys/TypeRefs.js" import {createPublicKeyReturn} from "../../../src/api/entities/sys/TypeRefs.js"
import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {BusinessFeatureRequiredError} from "../../../src/api/main/BusinessFeatureRequiredError" import {BusinessFeatureRequiredError} from "../../../src/api/main/BusinessFeatureRequiredError.js"
import {MailFacade} from "../../../src/api/worker/facades/MailFacade" import {MailFacade} from "../../../src/api/worker/facades/MailFacade.js"
import {EntityRestClientMock} from "../../api/worker/EntityRestClientMock" import {EntityRestClientMock} from "../api/worker/rest/EntityRestClientMock.js"
import {Time} from "../../../src/api/common/utils/Time" import {Time} from "../../../src/api/common/utils/Time.js"
import { import {
accountMailAddress, accountMailAddress,
calendarGroupId, calendarGroupId,
@ -52,7 +52,7 @@ import {
makeDistributor, makeDistributor,
makeMailboxDetail, makeMailboxDetail,
makeUserController, makeUserController,
} from "./CalendarTestUtils" } from "./CalendarTestUtils.js"
import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js" import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js"
const now = new Date(2020, 4, 25, 13, 40) const now = new Date(2020, 4, 25, 13, 40)

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {getDateFromMousePos, getTimeFromMousePos} from "../../../src/calendar/view/CalendarGuiUtils" import {getDateFromMousePos, getTimeFromMousePos} from "../../../src/calendar/view/CalendarGuiUtils.js"
o.spec("CalendarGuiUtils", function () { o.spec("CalendarGuiUtils", function () {
o("getDateFromMouseClick", function () { o("getDateFromMouseClick", function () {
function input(x, y, targetWidth, targetHeight) { function input(x, y, targetWidth, targetHeight) {

View file

@ -1,13 +1,13 @@
import o from "ospec" import o from "ospec"
import {parseCalendarStringData, serializeCalendar, serializeEvent} from "../../../src/calendar/export/CalendarImporter" import {parseCalendarStringData, serializeCalendar, serializeEvent} from "../../../src/calendar/export/CalendarImporter.js"
import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {createUserAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createUserAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {AlarmInterval, CalendarAttendeeStatus, EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants" import {AlarmInterval, CalendarAttendeeStatus, EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants.js"
import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js" import {createRepeatRule} from "../../../src/api/entities/sys/TypeRefs.js"
import {getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils" import {getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils.js"
import {getAllDayDateUTCFromZone} from "../../../src/calendar/date/CalendarUtils" import {getAllDayDateUTCFromZone} from "../../../src/calendar/date/CalendarUtils.js"
import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createEncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createEncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
const zone = "Europe/Berlin" const zone = "Europe/Berlin"

View file

@ -10,36 +10,36 @@ import {
getMonth, getMonth,
getTimeZone, getTimeZone,
incrementByRepeatPeriod, incrementByRepeatPeriod,
} from "../../../src/calendar/date/CalendarUtils" } from "../../../src/calendar/date/CalendarUtils.js"
import {clone, downcast, getStartOfDay, neverNull, noOp} from "@tutao/tutanota-utils" import {clone, downcast, getStartOfDay, neverNull, noOp} from "@tutao/tutanota-utils"
import type {CalendarModel} from "../../../src/calendar/model/CalendarModel" import type {CalendarModel} from "../../../src/calendar/model/CalendarModel.js"
import {CalendarModelImpl} from "../../../src/calendar/model/CalendarModel" import {CalendarModelImpl} from "../../../src/calendar/model/CalendarModel.js"
import {CalendarAttendeeStatus, CalendarMethod, EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants" import {CalendarAttendeeStatus, CalendarMethod, EndType, RepeatPeriod} from "../../../src/api/common/TutanotaConstants.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {generateEventElementId, getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils" import {generateEventElementId, getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils.js"
import type {EntityUpdateData} from "../../../src/api/main/EventController" import type {EntityUpdateData} from "../../../src/api/main/EventController.js"
import {EventController} from "../../../src/api/main/EventController" import {EventController} from "../../../src/api/main/EventController.js"
import {Notifications} from "../../../src/gui/Notifications" import {Notifications} from "../../../src/gui/Notifications.js"
import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEventAttendee} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createEncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createEncryptedMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {EntityRestClientMock} from "../../api/worker/EntityRestClientMock" import {EntityRestClientMock} from "../api/worker/rest/EntityRestClientMock.js"
import type {IUserController} from "../../../src/api/main/UserController" import type {IUserController} from "../../../src/api/main/UserController.js"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../src/api/entities/sys/TypeRefs.js"
import {createUserAlarmInfoListType} from "../../../src/api/entities/sys/TypeRefs.js" import {createUserAlarmInfoListType} from "../../../src/api/entities/sys/TypeRefs.js"
import {createUserAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createUserAlarmInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import type {CalendarGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createCalendarGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {NotFoundError} from "../../../src/api/common/error/RestError" import {NotFoundError} from "../../../src/api/common/error/RestError.js"
import type {LoginController} from "../../../src/api/main/LoginController" import type {LoginController} from "../../../src/api/main/LoginController.js"
import {ProgressTracker} from "../../../src/api/main/ProgressTracker" import {ProgressTracker} from "../../../src/api/main/ProgressTracker.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../src/api/common/EntityClient.js"
import {MailModel} from "../../../src/mail/model/MailModel" import {MailModel} from "../../../src/mail/model/MailModel.js"
import {AlarmScheduler} from "../../../src/calendar/date/AlarmScheduler" import {AlarmScheduler} from "../../../src/calendar/date/AlarmScheduler.js"
import {CalendarFacade} from "../../../src/api/worker/facades/CalendarFacade" import {CalendarFacade} from "../../../src/api/worker/facades/CalendarFacade.js"
import {asResult, mapToObject} from "@tutao/tutanota-test-utils" import {asResult, mapToObject} from "@tutao/tutanota-test-utils"
import type {WorkerClient} from "../../../src/api/main/WorkerClient" import type {WorkerClient} from "../../../src/api/main/WorkerClient.js"
import {FileController} from "../../../src/file/FileController" import {FileController} from "../../../src/file/FileController.js"
o.spec("CalendarModel", function () { o.spec("CalendarModel", function () {
o.spec("addDaysForEvent", function () { o.spec("addDaysForEvent", function () {

View file

@ -7,8 +7,8 @@ import {
parsePropertyKeyValue, parsePropertyKeyValue,
parseTime, parseTime,
propertySequenceParser, propertySequenceParser,
} from "../../../src/calendar/export/CalendarParser" } from "../../../src/calendar/export/CalendarParser.js"
import {ParserError, StringIterator} from "../../../src/misc/parsing/ParserCombinator" import {ParserError, StringIterator} from "../../../src/misc/parsing/ParserCombinator.js"
o.spec("CalendarParser", function () { o.spec("CalendarParser", function () {
o.spec("propertySequenceParser", function () { o.spec("propertySequenceParser", function () {

View file

@ -1,7 +1,7 @@
import {AccountType, FeatureType, GroupType, TimeFormat} from "../../../src/api/common/TutanotaConstants" import {AccountType, FeatureType, GroupType, TimeFormat} from "../../../src/api/common/TutanotaConstants.js"
import type {IUserController} from "../../../src/api/main/UserController" import type {IUserController} from "../../../src/api/main/UserController.js"
import {createBookingsRef} from "../../../src/api/entities/sys/TypeRefs.js" import {createBookingsRef} from "../../../src/api/entities/sys/TypeRefs.js"
import {GENERATED_MAX_ID} from "../../../src/api/common/utils/EntityUtils" import {GENERATED_MAX_ID} from "../../../src/api/common/utils/EntityUtils.js"
import {createFeature, Feature} from "../../../src/api/entities/sys/TypeRefs.js" import {createFeature, Feature} from "../../../src/api/entities/sys/TypeRefs.js"
import {downcast, LazyLoaded} from "@tutao/tutanota-utils" import {downcast, LazyLoaded} from "@tutao/tutanota-utils"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../src/api/entities/sys/TypeRefs.js"
@ -11,18 +11,18 @@ import {createGroupInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {createMailAddressAlias} from "../../../src/api/entities/sys/TypeRefs.js" import {createMailAddressAlias} from "../../../src/api/entities/sys/TypeRefs.js"
import {createCustomer} from "../../../src/api/entities/sys/TypeRefs.js" import {createCustomer} from "../../../src/api/entities/sys/TypeRefs.js"
import {createCustomerInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createCustomerInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import type {MailboxDetail} from "../../../src/mail/model/MailModel" import type {MailboxDetail} from "../../../src/mail/model/MailModel.js"
import {MailModel} from "../../../src/mail/model/MailModel" import {MailModel} from "../../../src/mail/model/MailModel.js"
import {createMailBox} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createMailBox} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createGroup} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroup} from "../../../src/api/entities/sys/TypeRefs.js"
import {createMailboxGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createMailboxGroupRoot} from "../../../src/api/entities/tutanota/TypeRefs.js"
import type {CalendarUpdateDistributor} from "../../../src/calendar/date/CalendarUpdateDistributor" import type {CalendarUpdateDistributor} from "../../../src/calendar/date/CalendarUpdateDistributor.js"
import o from "ospec" import o from "ospec"
import type {Contact} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Contact} from "../../../src/api/entities/tutanota/TypeRefs.js"
import type {ContactModel} from "../../../src/contacts/model/ContactModel" import type {ContactModel} from "../../../src/contacts/model/ContactModel.js"
import type {CalendarInfo} from "../../../src/calendar/model/CalendarModel" import type {CalendarInfo} from "../../../src/calendar/model/CalendarModel.js"
import {CalendarModel} from "../../../src/calendar/model/CalendarModel" import {CalendarModel} from "../../../src/calendar/model/CalendarModel.js"
import type {IProgressMonitor} from "../../../src/api/common/utils/ProgressMonitor" import type {IProgressMonitor} from "../../../src/api/common/utils/ProgressMonitor.js"
import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import type {AlarmOccurrence, CalendarMonth} from "../../../src/calendar/date/CalendarUtils" import type {AlarmOccurrence, CalendarMonth} from "../../../src/calendar/date/CalendarUtils.js"
import { import {
eventEndsBefore, eventEndsBefore,
eventStartsAfter, eventStartsAfter,
@ -12,17 +12,17 @@ import {
getWeekNumber, getWeekNumber,
isEventBetweenDays, isEventBetweenDays,
prepareCalendarDescription, prepareCalendarDescription,
} from "../../../src/calendar/date/CalendarUtils" } from "../../../src/calendar/date/CalendarUtils.js"
import {lang} from "../../../src/misc/LanguageViewModel" import {lang} from "../../../src/misc/LanguageViewModel.js"
import {createGroupMembership} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroupMembership} from "../../../src/api/entities/sys/TypeRefs.js"
import {createGroup} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroup} from "../../../src/api/entities/sys/TypeRefs.js"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../src/api/entities/sys/TypeRefs.js"
import {AlarmInterval, EndType, GroupType, RepeatPeriod, ShareCapability,} from "../../../src/api/common/TutanotaConstants" import {AlarmInterval, EndType, GroupType, RepeatPeriod, ShareCapability,} from "../../../src/api/common/TutanotaConstants.js"
import {timeStringFromParts} from "../../../src/misc/Formatter" import {timeStringFromParts} from "../../../src/misc/Formatter.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils" import {getAllDayDateUTC} from "../../../src/api/common/utils/CommonCalendarUtils.js"
import {hasCapabilityOnGroup} from "../../../src/sharing/GroupUtils" import {hasCapabilityOnGroup} from "../../../src/sharing/GroupUtils.js"
import {parseTime} from "../../../src/misc/parsing/TimeParser" import {parseTime} from "../../../src/misc/parsing/TimeParser.js"
import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {neverNull} from "@tutao/tutanota-utils"; import {neverNull} from "@tutao/tutanota-utils";

View file

@ -1,25 +1,25 @@
import o from "ospec" import o from "ospec"
import {accountMailAddress, calendarGroupId, makeCalendarModel, makeEvent, makeUserController,} from "./CalendarTestUtils" import {accountMailAddress, calendarGroupId, makeCalendarModel, makeEvent, makeUserController,} from "./CalendarTestUtils.js"
import type {LoginController} from "../../../src/api/main/LoginController" import type {LoginController} from "../../../src/api/main/LoginController.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {assertNotNull, downcast, getStartOfDay, LazyLoaded, neverNull} from "@tutao/tutanota-utils" import {assertNotNull, downcast, getStartOfDay, LazyLoaded, neverNull} from "@tutao/tutanota-utils"
import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {CalendarEvent} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createCalendarEvent, createEncryptedMailAddress,} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createCalendarEvent, createEncryptedMailAddress,} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {addDaysForEvent, getTimeZone} from "../../../src/calendar/date/CalendarUtils" import {addDaysForEvent, getTimeZone} from "../../../src/calendar/date/CalendarUtils.js"
import type {CalendarInfo, CalendarModel} from "../../../src/calendar/model/CalendarModel" import type {CalendarInfo, CalendarModel} from "../../../src/calendar/model/CalendarModel.js"
import type {CreateCalendarEventViewModelFunction} from "../../../src/calendar/view/CalendarViewModel" import type {CreateCalendarEventViewModelFunction} from "../../../src/calendar/view/CalendarViewModel.js"
import {CalendarViewModel} from "../../../src/calendar/view/CalendarViewModel" import {CalendarViewModel} from "../../../src/calendar/view/CalendarViewModel.js"
import {CalendarEventViewModel} from "../../../src/calendar/date/CalendarEventViewModel" import {CalendarEventViewModel} from "../../../src/calendar/date/CalendarEventViewModel.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../src/api/common/EntityClient.js"
import type {EntityUpdateData} from "../../../src/api/main/EventController" import type {EntityUpdateData} from "../../../src/api/main/EventController.js"
import {EventController} from "../../../src/api/main/EventController" import {EventController} from "../../../src/api/main/EventController.js"
import {ProgressTracker} from "../../../src/api/main/ProgressTracker" import {ProgressTracker} from "../../../src/api/main/ProgressTracker.js"
import {DeviceConfig} from "../../../src/misc/DeviceConfig" import {DeviceConfig} from "../../../src/misc/DeviceConfig.js"
import {OperationType} from "../../../src/api/common/TutanotaConstants" import {OperationType} from "../../../src/api/common/TutanotaConstants.js"
import {getElementId, getListId} from "../../../src/api/common/utils/EntityUtils" import {getElementId, getListId} from "../../../src/api/common/utils/EntityUtils.js"
import {EntityRestClientMock} from "../../api/worker/EntityRestClientMock" import {EntityRestClientMock} from "../api/worker/rest/EntityRestClientMock.js"
import {ReceivedGroupInvitationsModel} from "../../../src/sharing/model/ReceivedGroupInvitationsModel" import {ReceivedGroupInvitationsModel} from "../../../src/sharing/model/ReceivedGroupInvitationsModel.js"
let saveAndSendMock let saveAndSendMock
let rescheduleEventMock let rescheduleEventMock

View file

@ -1,14 +1,14 @@
import o from "ospec" import o from "ospec"
import {EventDragHandler} from "../../../src/calendar/view/EventDragHandler" import {EventDragHandler} from "../../../src/calendar/view/EventDragHandler.js"
import {defer, downcast} from "@tutao/tutanota-utils" import {defer, downcast} from "@tutao/tutanota-utils"
import type {DraggedEvent} from "../../../src/calendar/view/CalendarViewModel" import type {DraggedEvent} from "../../../src/calendar/view/CalendarViewModel.js"
import {makeEvent} from "./CalendarTestUtils" import {makeEvent} from "./CalendarTestUtils.js"
import { import {
getAllDayDateUTCFromZone, getAllDayDateUTCFromZone,
getStartOfDayWithZone, getStartOfDayWithZone,
getStartOfNextDayWithZone, getStartOfNextDayWithZone,
} from "../../../src/calendar/date/CalendarUtils" } from "../../../src/calendar/date/CalendarUtils.js"
import {isAllDayEvent} from "../../../src/api/common/utils/CommonCalendarUtils" import {isAllDayEvent} from "../../../src/api/common/utils/CommonCalendarUtils.js"
import {DateTime} from "luxon" import {DateTime} from "luxon"
import {DAY_IN_MILLIS} from "@tutao/tutanota-utils" import {DAY_IN_MILLIS} from "@tutao/tutanota-utils"
const INIT_MOUSE_POS = { const INIT_MOUSE_POS = {

View file

@ -16,7 +16,7 @@ import {
_getMergedSocialIds, _getMergedSocialIds,
getMergeableContacts, getMergeableContacts,
mergeContacts, mergeContacts,
} from "../../../src/contacts/ContactMergeUtils" } from "../../../src/contacts/ContactMergeUtils.js"
import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createContactPhoneNumber} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactPhoneNumber} from "../../../src/api/entities/tutanota/TypeRefs.js"
import { import {
@ -25,14 +25,14 @@ import {
ContactPhoneNumberType, ContactPhoneNumberType,
ContactSocialType, ContactSocialType,
IndifferentContactComparisonResult, IndifferentContactComparisonResult,
} from "../../../src/api/common/TutanotaConstants" } from "../../../src/api/common/TutanotaConstants.js"
import {createContactAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createContactSocialId} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactSocialId} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createFilledContact} from "./VCardExporterTest" import {createFilledContact} from "./VCardExporterTest.js"
import {downcast, neverNull} from "@tutao/tutanota-utils" import {downcast, neverNull} from "@tutao/tutanota-utils"
import {_contactToVCard} from "../../../src/contacts/VCardExporter" import {_contactToVCard} from "../../../src/contacts/VCardExporter.js"
import {createBirthday} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createBirthday} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {birthdayToIsoDate} from "../../../src/api/common/utils/BirthdayUtils" import {birthdayToIsoDate} from "../../../src/api/common/utils/BirthdayUtils.js"
o.spec("ContactMergeUtilsTest", function () { o.spec("ContactMergeUtilsTest", function () {
// tests are made for the validation of the comparison functions to find mergable contacts // tests are made for the validation of the comparison functions to find mergable contacts
// tests all ContactMergeUtils functions // tests all ContactMergeUtils functions

View file

@ -1,10 +1,10 @@
import o from "ospec" import o from "ospec"
import {createContact} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContact} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {formatBirthdayNumeric} from "../../../src/contacts/model/ContactUtils" import {formatBirthdayNumeric} from "../../../src/contacts/model/ContactUtils.js"
import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createContactMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createBirthday} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createBirthday} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {lang} from "../../../src/misc/LanguageViewModel" import {lang} from "../../../src/misc/LanguageViewModel.js"
import {compareContacts} from "../../../src/contacts/view/ContactGuiUtils" import {compareContacts} from "../../../src/contacts/view/ContactGuiUtils.js"
o.spec("ContactUtilsTest", function () { o.spec("ContactUtilsTest", function () {
let compare = function ( let compare = function (

View file

@ -1,3 +1,6 @@
// Attention! Be very careful with this file, there are some trailing whitespaces in multiline strings that can mess things up if your editor does not respect
// them.
import o from "ospec" import o from "ospec"
import type {Contact} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Contact} from "../../../src/api/entities/tutanota/TypeRefs.js"
import { import {
@ -9,16 +12,16 @@ import {
createContactPhoneNumber, createContactPhoneNumber,
createContactSocialId createContactSocialId
} from "../../../src/api/entities/tutanota/TypeRefs.js" } from "../../../src/api/entities/tutanota/TypeRefs.js"
import {ContactAddressType, ContactPhoneNumberType, ContactSocialType} from "../../../src/api/common/TutanotaConstants" import {ContactAddressType, ContactPhoneNumberType, ContactSocialType} from "../../../src/api/common/TutanotaConstants.js"
import { import {
_addressesToVCardAddresses, _addressesToVCardAddresses,
_phoneNumbersToVCardPhoneNumbers, _phoneNumbersToVCardPhoneNumbers,
_socialIdsToVCardSocialUrls, _socialIdsToVCardSocialUrls,
_vCardFormatArrayToString, _vCardFormatArrayToString,
contactsToVCard, contactsToVCard,
} from "../../../src/contacts/VCardExporter" } from "../../../src/contacts/VCardExporter.js"
import {neverNull} from "@tutao/tutanota-utils" import {neverNull} from "@tutao/tutanota-utils"
import {vCardFileToVCards, vCardListToContacts} from "../../../src/contacts/VCardImporter" import {vCardFileToVCards, vCardListToContacts} from "../../../src/contacts/VCardImporter.js"
let idCounter = 0 let idCounter = 0
o.spec("VCardExporterTest", function () { o.spec("VCardExporterTest", function () {
@ -168,29 +171,28 @@ BEGIN:VCARD\nVERSION:3.0\nFN:Phd. Bob Kev\nN:Kev;Bob;;Phd.;\nADR;TYPE=work:House
c1String = `BEGIN:VCARD\nVERSION:3.0\nFN:Ant\nN:;Ant;;;\nBDAY:1111-10-10\nEND:VCARD\n\n` c1String = `BEGIN:VCARD\nVERSION:3.0\nFN:Ant\nN:;Ant;;;\nBDAY:1111-10-10\nEND:VCARD\n\n`
o(contactsToVCard([contact1])).equals(c1String) o(contactsToVCard([contact1])).equals(c1String)
}) })
o("contactsToVCardsTestMoreThan75CharContentLine", function () {
let contactArray: Contact[] = [] o.spec("contactsToVCards more than 75 char content line", function () {
//todo Birthday test o("ADR", async function () {
let contact1 = createFilledContact( //todo Birthday test
"Ant", const contact = createFilledContact(
"Ste", "Ant",
"Hello World!", "Ste",
"Tutao", "Hello World!",
"Mr.", "Tutao",
"Buffalo", "Mr.",
["antste@antste.de", "bentste@bentste.de"], "Buffalo",
["123123123", "321321321"], ["antste@antste.de", "bentste@bentste.de"],
["diaspora.de"], ["123123123", "321321321"],
["Housestreet 123\nTown 123\nState 123\nCountry 123 this is so there is a line break in this contact"], ["diaspora.de"],
) ["Housestreet 123\nTown 123\nState 123\nCountry 123 this is so there is a line break in this contact"],
contactArray.push(contact1) )
let c1String = `BEGIN:VCARD const exprected = `BEGIN:VCARD
VERSION:3.0 VERSION:3.0
FN:Mr. Ant Ste FN:Mr. Ant Ste
N:Ste;Ant;;Mr.; N:Ste;Ant;;Mr.;
NICKNAME:Buffalo NICKNAME:Buffalo
ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so \n there is a line break in this contact
there is a line break in this contact
EMAIL;TYPE=work:antste@antste.de EMAIL;TYPE=work:antste@antste.de
EMAIL;TYPE=work:bentste@bentste.de EMAIL;TYPE=work:bentste@bentste.de
TEL;TYPE=work:123123123 TEL;TYPE=work:123123123
@ -201,28 +203,28 @@ NOTE:Hello World!
END:VCARD END:VCARD
` `
o(contactsToVCard(contactArray)).equals(c1String) o(contactsToVCard([contact])).equals(exprected)
contactArray = [] })
contact1 = createFilledContact(
"Ant", o("URL", async function () {
"Ste", const contact = createFilledContact(
"Hello World!", "Ant",
"Tutao is the best mail client for your privacy just go for it and youll see it will be amazing!!!!!", "Ste",
"Mr.", "Hello World!",
"Buffalo", "Tutao is the best mail client for your privacy just go for it and youll see it will be amazing!!!!!",
["antste@antste.de", "bentste@bentste.de"], "Mr.",
["123123123", "321321321"], "Buffalo",
["diaspora.de", "facebook.com/aaaa/bbb/cccccc/DDDDDDD/llllllll/uuuuuuu/ppppp/aaaaaaaaaaaaaaaaaaaaa"], ["antste@antste.de", "bentste@bentste.de"],
["Housestreet 123\nTown 123\nState 123\nCountry 123 this is so there is a line break in this contact"], ["123123123", "321321321"],
) ["diaspora.de", "facebook.com/aaaa/bbb/cccccc/DDDDDDD/llllllll/uuuuuuu/ppppp/aaaaaaaaaaaaaaaaaaaaa"],
contactArray.push(contact1) ["Housestreet 123\nTown 123\nState 123\nCountry 123 this is so there is a line break in this contact"],
c1String = `BEGIN:VCARD )
const expected = `BEGIN:VCARD
VERSION:3.0 VERSION:3.0
FN:Mr. Ant Ste FN:Mr. Ant Ste
N:Ste;Ant;;Mr.; N:Ste;Ant;;Mr.;
NICKNAME:Buffalo NICKNAME:Buffalo
ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so \n there is a line break in this contact
there is a line break in this contact
EMAIL;TYPE=work:antste@antste.de EMAIL;TYPE=work:antste@antste.de
EMAIL;TYPE=work:bentste@bentste.de EMAIL;TYPE=work:bentste@bentste.de
TEL;TYPE=work:123123123 TEL;TYPE=work:123123123
@ -236,8 +238,10 @@ NOTE:Hello World!
END:VCARD END:VCARD
` `
o(contactsToVCard(contactArray)).equals(c1String) o(contactsToVCard([contact])).equals(expected)
})
}) })
o("contactsToVCardsEscapingTest", function () { o("contactsToVCardsEscapingTest", function () {
let contactArray: Contact[] = [] let contactArray: Contact[] = []
//todo Birthday test //todo Birthday test
@ -428,8 +432,8 @@ END:VCARD
b.birthdayIso = "2016-09-09" b.birthdayIso = "2016-09-09"
o(JSON.stringify(contactsToVCard(contacts))).equals(JSON.stringify(a)) o(JSON.stringify(contactsToVCard(contacts))).equals(JSON.stringify(a))
}) })
o("testVCardImportToExport", function () { o("import export roundtrip", function () {
let cString = `BEGIN:VCARD const cString = `BEGIN:VCARD
VERSION:3.0 VERSION:3.0
FN:Mr. John\\;Quinlan Public FN:Mr. John\\;Quinlan Public
N:Public;John\\;Quinlan;;Mr.; N:Public;John\\;Quinlan;;Mr.;
@ -443,8 +447,7 @@ VERSION:3.0
FN:Mr. Ant Ste FN:Mr. Ant Ste
N:Ste;Ant;;Mr.; N:Ste;Ant;;Mr.;
NICKNAME:Buffalo NICKNAME:Buffalo
ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123 this is so \n there is a line break in this contact
there is a line break in this contact
EMAIL;TYPE=work:antste@antste.de EMAIL;TYPE=work:antste@antste.de
EMAIL;TYPE=work:bentste@bentste.de EMAIL;TYPE=work:bentste@bentste.de
TEL;TYPE=work:123123123 TEL;TYPE=work:123123123
@ -454,7 +457,22 @@ ORG:Tutao
NOTE:Hello World! NOTE:Hello World!
END:VCARD END:VCARD
BEGIN:VCARD\nVERSION:3.0\nFN:Mr. Ant Ste\nN:Ste;Ant;;Mr.;\nNICKNAME:Buffalo\nADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123\nEMAIL;TYPE=work:antste@antste.de\nEMAIL;TYPE=work:bentste@bentste.de\nTEL;TYPE=work:123123123\nTEL;TYPE=work:321321321\nURL:diaspora.de\nORG:Tutao\nNOTE:Hello World!\nEND:VCARD\n\n` BEGIN:VCARD
VERSION:3.0
FN:Mr. Ant Ste
N:Ste;Ant;;Mr.;
NICKNAME:Buffalo
ADR;TYPE=work:Housestreet 123\\nTown 123\\nState 123\\nCountry 123
EMAIL;TYPE=work:antste@antste.de
EMAIL;TYPE=work:bentste@bentste.de
TEL;TYPE=work:123123123
TEL;TYPE=work:321321321
URL:diaspora.de
ORG:Tutao
NOTE:Hello World!
END:VCARD
`
o(contactsToVCard(vCardListToContacts(neverNull(vCardFileToVCards(cString)), ""))).equals(cString) o(contactsToVCard(vCardListToContacts(neverNull(vCardFileToVCards(cString)), ""))).equals(cString)
}) })
}) })

View file

@ -1,10 +1,10 @@
import o from "ospec" import o from "ospec"
import {ContactAddressTypeRef, ContactMailAddressTypeRef, ContactPhoneNumberTypeRef, createContact} from "../../../src/api/entities/tutanota/TypeRefs.js" import {ContactAddressTypeRef, ContactMailAddressTypeRef, ContactPhoneNumberTypeRef, createContact} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {neverNull} from "@tutao/tutanota-utils" import {neverNull} from "@tutao/tutanota-utils"
import {vCardFileToVCards, vCardListToContacts} from "../../../src/contacts/VCardImporter" import {vCardFileToVCards, vCardListToContacts} from "../../../src/contacts/VCardImporter.js"
// @ts-ignore[untyped-import] // @ts-ignore[untyped-import]
import en from "../../../src/translations/en" import en from "../../../src/translations/en.js"
import {lang} from "../../../src/misc/LanguageViewModel" import {lang} from "../../../src/misc/LanguageViewModel.js"
o.spec("VCardImporterTest", function () { o.spec("VCardImporterTest", function () {
o.before(async function () { o.before(async function () {

View file

@ -1,15 +1,15 @@
import o from "ospec" import o from "ospec"
import n from "../nodemocker" import n from "../nodemocker.js"
import {defer, DeferredObject, delay, downcast} from "@tutao/tutanota-utils" import {defer, DeferredObject, delay, downcast} from "@tutao/tutanota-utils"
import {ApplicationWindow} from "../../../src/desktop/ApplicationWindow" import {ApplicationWindow} from "../../../src/desktop/ApplicationWindow.js"
import type {NativeImage} from "electron" import type {NativeImage} from "electron"
import {ThemeManager} from "../../../src/desktop/ThemeManager" import {ThemeManager} from "../../../src/desktop/ThemeManager.js"
import type {Theme, ThemeId} from "../../../src/gui/theme" import type {Theme, ThemeId} from "../../../src/gui/theme.js"
import {DesktopConfig} from "../../../src/desktop/config/DesktopConfig" import {DesktopConfig} from "../../../src/desktop/config/DesktopConfig.js"
import {WindowManager} from "../../../src/desktop/DesktopWindowManager"; import {WindowManager} from "../../../src/desktop/DesktopWindowManager.js";
import {LocalShortcutManager} from "../../../src/desktop/electron-localshortcut/LocalShortcut"; import {LocalShortcutManager} from "../../../src/desktop/electron-localshortcut/LocalShortcut.js";
import {object} from "testdouble" import {object} from "testdouble"
import {OfflineDbFacade} from "../../../src/desktop/db/OfflineDbFacade" import {OfflineDbFacade} from "../../../src/desktop/db/OfflineDbFacade.js"
import {verify} from "@tutao/tutanota-test-utils" import {verify} from "@tutao/tutanota-test-utils"
import Rectangle = Electron.Rectangle import Rectangle = Electron.Rectangle

View file

@ -1,8 +1,8 @@
import o from "ospec" import o from "ospec"
import n from "../nodemocker" import n from "../nodemocker.js"
import {DesktopContextMenu} from "../../../src/desktop/DesktopContextMenu" import {DesktopContextMenu} from "../../../src/desktop/DesktopContextMenu.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {IPC} from "../../../src/desktop/IPC"; import {IPC} from "../../../src/desktop/IPC.js";
import ContextMenuParams = Electron.ContextMenuParams; import ContextMenuParams = Electron.ContextMenuParams;
o.spec("DesktopContextMenu Test", () => { o.spec("DesktopContextMenu Test", () => {

View file

@ -1,12 +1,12 @@
import n from "../nodemocker" import n from "../nodemocker.js"
import o from "ospec" import o from "ospec"
import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade" import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade.js"
import {stringToUtf8Uint8Array, uint8ArrayToBase64} from "@tutao/tutanota-utils" import {stringToUtf8Uint8Array, uint8ArrayToBase64} from "@tutao/tutanota-utils"
import {arrayEquals} from "@tutao/tutanota-utils" import {arrayEquals} from "@tutao/tutanota-utils"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import type {CryptoFunctions} from "../../../src/desktop/CryptoFns" import type {CryptoFunctions} from "../../../src/desktop/CryptoFns.js"
import type {TypeModel} from "../../../src/api/common/EntityTypes" import type {TypeModel} from "../../../src/api/common/EntityTypes.js"
import type {Base64} from "@tutao/tutanota-utils/" import type {Base64} from "@tutao/tutanota-utils"
import {keyToBase64, uint8ArrayToBitArray} from "@tutao/tutanota-crypto" import {keyToBase64, uint8ArrayToBitArray} from "@tutao/tutanota-crypto"
o.spec("DesktopCryptoFacadeTest", () => { o.spec("DesktopCryptoFacadeTest", () => {

View file

@ -1,10 +1,10 @@
import o from "ospec" import o from "ospec"
import n, {Mocked} from "../nodemocker" import n, {Mocked} from "../nodemocker.js"
import {DesktopDownloadManager} from "../../../src/desktop/DesktopDownloadManager" import {DesktopDownloadManager} from "../../../src/desktop/DesktopDownloadManager.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {CancelledError} from "../../../src/api/common/error/CancelledError" import {CancelledError} from "../../../src/api/common/error/CancelledError.js"
import {DesktopNetworkClient} from "../../../src/desktop/DesktopNetworkClient" import {DesktopNetworkClient} from "../../../src/desktop/DesktopNetworkClient.js"
import {PreconditionFailedError, TooManyRequestsError} from "../../../src/api/common/error/RestError" import {PreconditionFailedError, TooManyRequestsError} from "../../../src/api/common/error/RestError.js"
import type * as fs from "fs" import type * as fs from "fs"
import {stringToUtf8Uint8Array, uint8ArrayToBase64} from "@tutao/tutanota-utils" import {stringToUtf8Uint8Array, uint8ArrayToBase64} from "@tutao/tutanota-utils"
import {sha256Hash} from "@tutao/tutanota-crypto" import {sha256Hash} from "@tutao/tutanota-crypto"

View file

@ -1,8 +1,8 @@
import o from "ospec" import o from "ospec"
import type {ElectronNotificationFactory} from "../../../src/desktop/NotificatonFactory" import type {ElectronNotificationFactory} from "../../../src/desktop/NotificatonFactory.js"
import {defer, delay, downcast} from "@tutao/tutanota-utils" import {defer, delay, downcast} from "@tutao/tutanota-utils"
import {DesktopNotifier} from "../../../src/desktop/DesktopNotifier" import {DesktopNotifier} from "../../../src/desktop/DesktopNotifier.js"
import type {DesktopTray} from "../../../src/desktop/tray/DesktopTray" import type {DesktopTray} from "../../../src/desktop/tray/DesktopTray.js"
import type {NativeImage} from "electron" import type {NativeImage} from "electron"
// just a placeholder, symbol to make sure it's the same instance // just a placeholder, symbol to make sure it's the same instance

View file

@ -1,16 +1,16 @@
import o from "ospec" import o from "ospec"
import type {App} from "electron" import type {App} from "electron"
import type {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade" import type {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {ElectronUpdater} from "../../../src/desktop/ElectronUpdater" import {ElectronUpdater} from "../../../src/desktop/ElectronUpdater.js"
import type {DesktopTray} from "../../../src/desktop/tray/DesktopTray" import type {DesktopTray} from "../../../src/desktop/tray/DesktopTray.js"
import type {UpdaterWrapper} from "../../../src/desktop/UpdaterWrapper" import type {UpdaterWrapper} from "../../../src/desktop/UpdaterWrapper.js"
import n from "../nodemocker" import n from "../nodemocker.js"
import type {DesktopConfig} from "../../../src/desktop/config/DesktopConfig" import type {DesktopConfig} from "../../../src/desktop/config/DesktopConfig.js"
import type {DesktopNotifier} from "../../../src/desktop/DesktopNotifier" import type {DesktopNotifier} from "../../../src/desktop/DesktopNotifier.js"
import {lang} from "../../../src/misc/LanguageViewModel" import {lang} from "../../../src/misc/LanguageViewModel.js"
// @ts-ignore[untyped-import] // @ts-ignore[untyped-import]
import en from "../../../src/translations/en" import en from "../../../src/translations/en.js"
import {delay} from "@tutao/tutanota-utils" import {delay} from "@tutao/tutanota-utils"
lang.init(en) lang.init(en)

View file

@ -1,28 +1,28 @@
import n from "../nodemocker" import n from "../nodemocker.js"
import o from "ospec" import o from "ospec"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import {defer, delay, noOp} from "@tutao/tutanota-utils" import {defer, delay, noOp} from "@tutao/tutanota-utils"
import {IPC} from "../../../src/desktop/IPC" import {IPC} from "../../../src/desktop/IPC.js"
import type {Message} from "../../../src/api/common/MessageDispatcher" import type {Message} from "../../../src/api/common/MessageDispatcher.js"
import {Request, RequestError, Response} from "../../../src/api/common/MessageDispatcher" import {Request, RequestError, Response} from "../../../src/api/common/MessageDispatcher.js"
import {DesktopConfig} from "../../../src/desktop/config/DesktopConfig"; import {DesktopConfig} from "../../../src/desktop/config/DesktopConfig.js";
import {DesktopNotifier} from "../../../src/desktop/DesktopNotifier"; import {DesktopNotifier} from "../../../src/desktop/DesktopNotifier.js";
import {DesktopSseClient} from "../../../src/desktop/sse/DesktopSseClient"; import {DesktopSseClient} from "../../../src/desktop/sse/DesktopSseClient.js";
import {WindowManager} from "../../../src/desktop/DesktopWindowManager"; import {WindowManager} from "../../../src/desktop/DesktopWindowManager.js";
import {Socketeer} from "../../../src/desktop/Socketeer"; import {Socketeer} from "../../../src/desktop/Socketeer.js";
import {DesktopAlarmStorage} from "../../../src/desktop/sse/DesktopAlarmStorage"; import {DesktopAlarmStorage} from "../../../src/desktop/sse/DesktopAlarmStorage.js";
import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade"; import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade.js";
import {DesktopDownloadManager} from "../../../src/desktop/DesktopDownloadManager"; import {DesktopDownloadManager} from "../../../src/desktop/DesktopDownloadManager.js";
import {ElectronUpdater} from "../../../src/desktop/ElectronUpdater"; import {ElectronUpdater} from "../../../src/desktop/ElectronUpdater.js";
import {DesktopUtils} from "../../../src/desktop/DesktopUtils"; import {DesktopUtils} from "../../../src/desktop/DesktopUtils.js";
import {DesktopErrorHandler} from "../../../src/desktop/DesktopErrorHandler"; import {DesktopErrorHandler} from "../../../src/desktop/DesktopErrorHandler.js";
import {DesktopIntegrator} from "../../../src/desktop/integration/DesktopIntegrator"; import {DesktopIntegrator} from "../../../src/desktop/integration/DesktopIntegrator.js";
import {DesktopAlarmScheduler} from "../../../src/desktop/sse/DesktopAlarmScheduler"; import {DesktopAlarmScheduler} from "../../../src/desktop/sse/DesktopAlarmScheduler.js";
import {ThemeManager} from "../../../src/desktop/ThemeManager"; import {ThemeManager} from "../../../src/desktop/ThemeManager.js";
import {OfflineDbFacade} from "../../../src/desktop/db/OfflineDbFacade" import {OfflineDbFacade} from "../../../src/desktop/db/OfflineDbFacade.js"
import {DektopCredentialsEncryption, DesktopCredentialsEncryptionStub} from "../../../src/desktop/credentials/DektopCredentialsEncryption" import {DektopCredentialsEncryption, DesktopCredentialsEncryptionStub} from "../../../src/desktop/credentials/DektopCredentialsEncryption.js"
import {object} from "testdouble" import {object} from "testdouble"
import {ExposedNativeInterface} from "../../../src/native/common/NativeInterface" import {ExposedNativeInterface} from "../../../src/native/common/NativeInterface.js"
o.spec("IPC tests", function () { o.spec("IPC tests", function () {
const CALLBACK_ID = "to-main" const CALLBACK_ID = "to-main"

View file

@ -1,12 +1,12 @@
import o from "ospec" import o from "ospec"
import {CredentialsKeySpec, DeviceKeySpec, KeyStoreFacadeImpl} from "../../../src/desktop/KeyStoreFacadeImpl" import {CredentialsKeySpec, DeviceKeySpec, KeyStoreFacadeImpl} from "../../../src/desktop/KeyStoreFacadeImpl.js"
import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade" import {DesktopCryptoFacade} from "../../../src/desktop/DesktopCryptoFacade.js"
import type {SecretStorage} from "../../../src/desktop/sse/SecretStorage" import type {SecretStorage} from "../../../src/desktop/sse/SecretStorage.js"
import {spyify} from "../nodemocker" import {spyify} from "../nodemocker.js"
import {keyToBase64, uint8ArrayToKey} from "@tutao/tutanota-crypto" import {keyToBase64, uint8ArrayToKey} from "@tutao/tutanota-crypto"
import {CancelledError} from "../../../src/api/common/error/CancelledError" import {CancelledError} from "../../../src/api/common/error/CancelledError.js"
import {assertThrows} from "../../../packages/tutanota-test-utils/lib" import {assertThrows} from "@tutao/tutanota-test-utils"
import {DeviceStorageUnavailableError} from "../../../src/api/common/error/DeviceStorageUnavailableError" import {DeviceStorageUnavailableError} from "../../../src/api/common/error/DeviceStorageUnavailableError.js"
function initKeyStoreFacade(secretStorage: SecretStorage, crypto: DesktopCryptoFacade): KeyStoreFacadeImpl { function initKeyStoreFacade(secretStorage: SecretStorage, crypto: DesktopCryptoFacade): KeyStoreFacadeImpl {
return new KeyStoreFacadeImpl(secretStorage, crypto) return new KeyStoreFacadeImpl(secretStorage, crypto)

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {nonClobberingFilename, swapFilename} from "../../../src/desktop/PathUtils" import {nonClobberingFilename, swapFilename} from "../../../src/desktop/PathUtils.js"
import path from "path" import path from "path"
o.spec("PathUtils", function () { o.spec("PathUtils", function () {
o.spec("nonClobberingFileName Test", function () { o.spec("nonClobberingFileName Test", function () {

View file

@ -1,7 +1,7 @@
import n from "../nodemocker" import n from "../nodemocker.js"
import o from "ospec" import o from "ospec"
import {makeTimeoutMock} from "@tutao/tutanota-test-utils" import {makeTimeoutMock} from "@tutao/tutanota-test-utils"
import {Socketeer} from "../../../src/desktop/Socketeer" import {Socketeer} from "../../../src/desktop/Socketeer.js"
o.spec("Socketeer Test", function () { o.spec("Socketeer Test", function () {
const electron = { const electron = {
app: { app: {

View file

@ -1,7 +1,7 @@
import o from "ospec" import o from "ospec"
import n from "../../nodemocker" import n from "../../nodemocker.js"
import {delay, numberRange} from "@tutao/tutanota-utils" import {delay, numberRange} from "@tutao/tutanota-utils"
import {getConfigFile} from "../../../../src/desktop/config/ConfigFile" import {getConfigFile} from "../../../../src/desktop/config/ConfigFile.js"
const MAX_LATENCY = 20 const MAX_LATENCY = 20
const rndDelay = () => delay(Math.floor(Math.random() * MAX_LATENCY)) const rndDelay = () => delay(Math.floor(Math.random() * MAX_LATENCY))

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import {DesktopConfigMigrator} from "../../../../../src/desktop/config/migrations/DesktopConfigMigrator" import {DesktopConfigMigrator} from "../../../../../src/desktop/config/migrations/DesktopConfigMigrator.js"
import {DesktopCryptoFacade} from "../../../../../src/desktop/DesktopCryptoFacade" import {DesktopCryptoFacade} from "../../../../../src/desktop/DesktopCryptoFacade.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import {makeKeyStoreFacade} from "../../../../api/TestUtils" import {makeKeyStoreFacade} from "../../../TestUtils.js"
import {DesktopKeyStoreFacade} from "../../../../../src/desktop/KeyStoreFacadeImpl"; import {DesktopKeyStoreFacade} from "../../../../../src/desktop/KeyStoreFacadeImpl.js";
o.spec('DesktopConfigMigrator', function () { o.spec('DesktopConfigMigrator', function () {
let migrator let migrator

View file

@ -1,11 +1,11 @@
import o from "ospec" import o from "ospec"
import n from "../../nodemocker" import n from "../../nodemocker.js"
import {DesktopCredentialsEncryptionImpl} from "../../../../src/desktop/credentials/DektopCredentialsEncryption" import {DesktopCredentialsEncryptionImpl} from "../../../../src/desktop/credentials/DektopCredentialsEncryption.js"
import {DesktopKeyStoreFacade} from "../../../../src/desktop/KeyStoreFacadeImpl" import {DesktopKeyStoreFacade} from "../../../../src/desktop/KeyStoreFacadeImpl.js"
import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade" import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade.js"
import {CredentialEncryptionMode} from "../../../../src/misc/credentials/CredentialEncryptionMode" import {CredentialEncryptionMode} from "../../../../src/misc/credentials/CredentialEncryptionMode.js"
import {makeKeyStoreFacade} from "../../../api/TestUtils" import {makeKeyStoreFacade} from "../../TestUtils.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
o.spec("DesktopCredentialsEncryption Test", () => { o.spec("DesktopCredentialsEncryption Test", () => {

View file

@ -1,8 +1,8 @@
import o from "ospec" import o from "ospec"
import {OfflineDbFacade, OfflineDbFactory} from "../../../../src/desktop/db/OfflineDbFacade" import {OfflineDbFacade, OfflineDbFactory} from "../../../../src/desktop/db/OfflineDbFacade.js"
import {object, when} from "testdouble" import {object, when} from "testdouble"
import {verify} from "@tutao/tutanota-test-utils" import {verify} from "@tutao/tutanota-test-utils"
import {OfflineDb} from "../../../../src/desktop/db/OfflineDb" import {OfflineDb} from "../../../../src/desktop/db/OfflineDb.js"
o.spec("OfflineDbFacade", function () { o.spec("OfflineDbFacade", function () {
let factory: OfflineDbFactory let factory: OfflineDbFactory

View file

@ -1,10 +1,10 @@
import o from "ospec" import o from "ospec"
import {OfflineDb} from "../../../../src/desktop/db/OfflineDb" import {OfflineDb} from "../../../../src/desktop/db/OfflineDb.js"
import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {ContactTypeRef} from "../../../../src/api/entities/tutanota/TypeRefs.js"
import {GENERATED_MAX_ID, GENERATED_MIN_ID} from "../../../../src/api/common/utils/EntityUtils" import {GENERATED_MAX_ID, GENERATED_MIN_ID} from "../../../../src/api/common/utils/EntityUtils.js"
import {UserTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js" import {UserTypeRef} from "../../../../src/api/entities/sys/TypeRefs.js"
import {concat, stringToUtf8Uint8Array} from "@tutao/tutanota-utils" import {concat, stringToUtf8Uint8Array} from "@tutao/tutanota-utils"
import {calendarGroupId} from "../../calendar/CalendarTestUtils" import {calendarGroupId} from "../../calendar/CalendarTestUtils.js"
import * as fs from "fs" import * as fs from "fs"
import * as cborg from "cborg" import * as cborg from "cborg"
import {CryptoError} from "@tutao/tutanota-crypto" import {CryptoError} from "@tutao/tutanota-crypto"

View file

@ -1,13 +1,13 @@
import o from "ospec" import o from "ospec"
import n from "../../nodemocker" import n from "../../nodemocker.js"
import {getDesktopIntegratorForPlatform} from "../../../../src/desktop/integration/DesktopIntegrator" import {getDesktopIntegratorForPlatform} from "../../../../src/desktop/integration/DesktopIntegrator.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
import type {WindowManager} from "../../../../src/desktop/DesktopWindowManager" import type {WindowManager} from "../../../../src/desktop/DesktopWindowManager.js"
import {lang} from "../../../../src/misc/LanguageViewModel" import {lang} from "../../../../src/misc/LanguageViewModel.js"
import en from "../../../../src/translations/en" import en from "../../../../src/translations/en.js"
import {DesktopIntegratorLinux} from "../../../../src/desktop/integration/DesktopIntegratorLinux" import {DesktopIntegratorLinux} from "../../../../src/desktop/integration/DesktopIntegratorLinux.js"
import {DesktopIntegratorDarwin} from "../../../../src/desktop/integration/DesktopIntegratorDarwin" import {DesktopIntegratorDarwin} from "../../../../src/desktop/integration/DesktopIntegratorDarwin.js"
import {DesktopIntegratorWin32} from "../../../../src/desktop/integration/DesktopIntegratorWin32" import {DesktopIntegratorWin32} from "../../../../src/desktop/integration/DesktopIntegratorWin32.js"
const desktopEntry = `[Desktop Entry] const desktopEntry = `[Desktop Entry]
Name=Tutanota Desktop Name=Tutanota Desktop

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {applyScriptBuilder, removeScriptBuilder} from "../../../../src/desktop/integration/RegistryScriptGenerator" import {applyScriptBuilder, removeScriptBuilder} from "../../../../src/desktop/integration/RegistryScriptGenerator.js"
o.spec("RegistryScriptGenerator Test", function () { o.spec("RegistryScriptGenerator Test", function () {

View file

@ -1,14 +1,14 @@
import o from "ospec" import o from "ospec"
import n from '../../nodemocker' import n from '../../nodemocker.js'
import {EndType, RepeatPeriod} from "../../../../src/api/common/TutanotaConstants" import {EndType, RepeatPeriod} from "../../../../src/api/common/TutanotaConstants.js"
import {DesktopAlarmScheduler, EncryptedAlarmNotification} from "../../../../src/desktop/sse/DesktopAlarmScheduler" import {DesktopAlarmScheduler, EncryptedAlarmNotification} from "../../../../src/desktop/sse/DesktopAlarmScheduler.js"
import type {AlarmScheduler} from "../../../../src/calendar/date/AlarmScheduler" import type {AlarmScheduler} from "../../../../src/calendar/date/AlarmScheduler.js"
import {CryptoError} from "../../../../src/api/common/error/CryptoError" import {CryptoError} from "../../../../src/api/common/error/CryptoError.js"
import {downcast, lastThrow} from "@tutao/tutanota-utils" import {downcast, lastThrow} from "@tutao/tutanota-utils"
import {WindowManager} from "../../../../src/desktop/DesktopWindowManager"; import {WindowManager} from "../../../../src/desktop/DesktopWindowManager.js";
import {DesktopNotifier, NotificationResult} from "../../../../src/desktop/DesktopNotifier"; import {DesktopNotifier, NotificationResult} from "../../../../src/desktop/DesktopNotifier.js";
import {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage"; import {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage.js";
import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade"; import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade.js";
import {assertThrows} from "@tutao/tutanota-test-utils"; import {assertThrows} from "@tutao/tutanota-test-utils";
const START_DATE = new Date(2019, 9, 10, 14).getTime() const START_DATE = new Date(2019, 9, 10, 14).getTime()

View file

@ -1,11 +1,11 @@
import o from "ospec" import o from "ospec"
import {instance, matchers, verify, when} from "testdouble" import {instance, matchers, verify, when} from "testdouble"
import {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage" import {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage.js"
import {DesktopConfig} from "../../../../src/desktop/config/DesktopConfig" import {DesktopConfig} from "../../../../src/desktop/config/DesktopConfig.js"
import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade" import {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade.js"
import type {DesktopKeyStoreFacade} from "../../../../src/desktop/KeyStoreFacadeImpl" import type {DesktopKeyStoreFacade} from "../../../../src/desktop/KeyStoreFacadeImpl.js"
import {makeKeyStoreFacade} from "../../../api/TestUtils" import {makeKeyStoreFacade} from "../../TestUtils.js"
import {DesktopConfigKey} from "../../../../src/desktop/config/ConfigKeys" import {DesktopConfigKey} from "../../../../src/desktop/config/ConfigKeys.js"
o.spec("DesktopAlarmStorageTest", function () { o.spec("DesktopAlarmStorageTest", function () {

View file

@ -1,25 +1,25 @@
import o from "ospec" import o from "ospec"
import n from "../../nodemocker" import n from "../../nodemocker.js"
import type {DeferredObject} from "@tutao/tutanota-utils" import type {DeferredObject} from "@tutao/tutanota-utils"
import type {TimeoutMock} from "@tutao/tutanota-test-utils" import type {TimeoutMock} from "@tutao/tutanota-test-utils"
import {makeTimeoutMock} from "@tutao/tutanota-test-utils" import {makeTimeoutMock} from "@tutao/tutanota-test-utils"
import {defer, delay, downcast, neverNull, noOp, numberRange} from "@tutao/tutanota-utils" import {defer, delay, downcast, neverNull, noOp, numberRange} from "@tutao/tutanota-utils"
import {AlarmInterval} from "../../../../src/api/common/TutanotaConstants" import {AlarmInterval} from "../../../../src/api/common/TutanotaConstants.js"
import * as url from "url" import * as url from "url"
import * as querystring from "querystring" import * as querystring from "querystring"
import {createMissedNotification} from "../../../../src/api/entities/sys/TypeRefs.js" import {createMissedNotification} from "../../../../src/api/entities/sys/TypeRefs.js"
import {DesktopSseClient} from "../../../../src/desktop/sse/DesktopSseClient" import {DesktopSseClient} from "../../../../src/desktop/sse/DesktopSseClient.js"
import {DesktopConfigEncKey, DesktopConfigKey} from "../../../../src/desktop/config/ConfigKeys" import {DesktopConfigEncKey, DesktopConfigKey} from "../../../../src/desktop/config/ConfigKeys.js"
import type {DesktopConfig} from "../../../../src/desktop/config/DesktopConfig" import type {DesktopConfig} from "../../../../src/desktop/config/DesktopConfig.js"
import type {DesktopNotifier} from "../../../../src/desktop/DesktopNotifier" import type {DesktopNotifier} from "../../../../src/desktop/DesktopNotifier.js"
import type {WindowManager} from "../../../../src/desktop/DesktopWindowManager" import type {WindowManager} from "../../../../src/desktop/DesktopWindowManager.js"
import type {DesktopAlarmScheduler} from "../../../../src/desktop/sse/DesktopAlarmScheduler" import type {DesktopAlarmScheduler} from "../../../../src/desktop/sse/DesktopAlarmScheduler.js"
import type {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade" import type {DesktopCryptoFacade} from "../../../../src/desktop/DesktopCryptoFacade.js"
import type {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage" import type {DesktopAlarmStorage} from "../../../../src/desktop/sse/DesktopAlarmStorage.js"
import type {LanguageViewModel} from "../../../../src/misc/LanguageViewModel" import type {LanguageViewModel} from "../../../../src/misc/LanguageViewModel.js"
import type {DesktopNetworkClient} from "../../../../src/desktop/DesktopNetworkClient" import type {DesktopNetworkClient} from "../../../../src/desktop/DesktopNetworkClient.js"
import {ServiceUnavailableError, TooManyRequestsError} from "../../../../src/api/common/error/RestError" import {ServiceUnavailableError, TooManyRequestsError} from "../../../../src/api/common/error/RestError.js"
import modelInfo from "../../../../src/api/entities/sys/ModelInfo" import modelInfo from "../../../../src/api/entities/sys/ModelInfo.js"
o.spec("DesktopSseClient Test", function () { o.spec("DesktopSseClient Test", function () {
const identifier = 'identifier' const identifier = 'identifier'

View file

@ -1,14 +1,14 @@
import o from "ospec" import o from "ospec"
import {ArchiveDataType} from "../../../src/api/common/TutanotaConstants" import {ArchiveDataType} from "../../../src/api/common/TutanotaConstants.js"
import {FileController} from "../../../src/file/FileController" import {FileController} from "../../../src/file/FileController.js"
import {BlobFacade} from "../../../src/api/worker/facades/BlobFacade" import {BlobFacade} from "../../../src/api/worker/facades/BlobFacade.js"
import {FileFacade} from "../../../src/api/worker/facades/FileFacade" import {FileFacade} from "../../../src/api/worker/facades/FileFacade.js"
import {NativeFileApp} from "../../../src/native/common/FileApp" import {NativeFileApp} from "../../../src/native/common/FileApp.js"
import {matchers, object, verify, when} from "testdouble" import {matchers, object, verify, when} from "testdouble"
import {FileReference} from "../../../src/api/common/utils/FileUtils" import {FileReference} from "../../../src/api/common/utils/FileUtils.js"
import {neverNull} from "@tutao/tutanota-utils" import {neverNull} from "@tutao/tutanota-utils"
import {DataFile} from "../../../src/api/common/DataFile" import {DataFile} from "../../../src/api/common/DataFile.js"
import {createBlob} from "../../../src/api/entities/sys/TypeRefs" import {createBlob} from "../../../src/api/entities/sys/TypeRefs.js"
import {createFile} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createFile} from "../../../src/api/entities/tutanota/TypeRefs.js"
const {anything, captor} = matchers const {anything, captor} = matchers

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {hexToRgb, isColorLight, rgbToHex} from "../../../src/gui/base/Color" import {hexToRgb, isColorLight, rgbToHex} from "../../../src/gui/base/Color.js"
o.spec("color", function () { o.spec("color", function () {
o("hexToRGB 6digit", function () { o("hexToRGB 6digit", function () {
o(hexToRgb("#b73a9a")).deepEquals({ o(hexToRgb("#b73a9a")).deepEquals({

View file

@ -1,6 +1,6 @@
import o from "ospec" import o from "ospec"
import {Dialog} from "../../../src/gui/base/Dialog" import {Dialog} from "../../../src/gui/base/Dialog.js"
import {getConfirmation, getPosAndBoundsFromMouseEvent} from "../../../src/gui/base/GuiUtils" import {getConfirmation, getPosAndBoundsFromMouseEvent} from "../../../src/gui/base/GuiUtils.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
o.spec("GuiUtils", function () { o.spec("GuiUtils", function () {
o.spec("getConfirmation ok", function () { o.spec("getConfirmation ok", function () {

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import type {Theme, ThemeId} from "../../../src/gui/theme" import type {Theme, ThemeId} from "../../../src/gui/theme.js"
import n from "../nodemocker" import n from "../nodemocker.js"
import type {ThemeStorage} from "../../../src/gui/ThemeController" import type {ThemeStorage} from "../../../src/gui/ThemeController.js"
import {ThemeController} from "../../../src/gui/ThemeController" import {ThemeController} from "../../../src/gui/ThemeController.js"
import type {ThemeCustomizations} from "../../../src/misc/WhitelabelCustomizations" import type {ThemeCustomizations} from "../../../src/misc/WhitelabelCustomizations.js"
import {downcast} from "@tutao/tutanota-utils" import {downcast} from "@tutao/tutanota-utils"
o.spec("Theme Controller", function () { o.spec("Theme Controller", function () {

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import type {DomMutation} from "../../../../src/gui/animation/Animations" import type {DomMutation} from "../../../../src/gui/animation/Animations.js"
import { import {
alpha, alpha,
AlphaEnum, AlphaEnum,
@ -8,10 +8,10 @@ import {
DefaultAnimationTime, DefaultAnimationTime,
transform, transform,
TransformEnum TransformEnum
} from "../../../../src/gui/animation/Animations" } from "../../../../src/gui/animation/Animations.js"
import {ease} from "../../../../src/gui/animation/Easing" import {ease} from "../../../../src/gui/animation/Easing.js"
import {client} from "../../../../src/misc/ClientDetector" import {client} from "../../../../src/misc/ClientDetector.js"
import {DeviceType} from "../../../../src/misc/ClientConstants" import {DeviceType} from "../../../../src/misc/ClientConstants.js"
import {assertNotNull, downcast} from "@tutao/tutanota-utils" import {assertNotNull, downcast} from "@tutao/tutanota-utils"
client.device = DeviceType.DESKTOP client.device = DeviceType.DESKTOP

View file

@ -1,9 +1,9 @@
import o from "ospec" import o from "ospec"
import {List, ScrollBuffer} from "../../../../src/gui/base/List" import {List, ScrollBuffer} from "../../../../src/gui/base/List.js"
import {downcast, noOp} from "@tutao/tutanota-utils" import {downcast, noOp} from "@tutao/tutanota-utils"
import {createMail} from "../../../../src/api/entities/tutanota/TypeRefs.js" import {createMail} from "../../../../src/api/entities/tutanota/TypeRefs.js"
import {GENERATED_MAX_ID} from "../../../../src/api/common/utils/EntityUtils"; import {GENERATED_MAX_ID} from "../../../../src/api/common/utils/EntityUtils.js";
import type {ListElement} from "../../../../src/api/common/utils/EntityUtils" import type {ListElement} from "../../../../src/api/common/utils/EntityUtils.js"
function dummySort() { function dummySort() {
return 0 return 0

View file

@ -1,12 +1,12 @@
import o from "ospec" import o from "ospec"
import {createWizardDialog, WizardPageWrapper} from "../../../../src/gui/base/WizardDialogN" import {createWizardDialog, WizardPageWrapper} from "../../../../src/gui/base/WizardDialogN.js"
import {Dialog} from "../../../../src/gui/base/Dialog" import {Dialog} from "../../../../src/gui/base/Dialog.js"
import {EnterDomainPageAttrs} from "../../../../src/settings/emaildomain/EnterDomainPage" import {EnterDomainPageAttrs} from "../../../../src/settings/emaildomain/EnterDomainPage.js"
import stream from "mithril/stream"; import stream from "mithril/stream";
import {createCustomerInfo} from "../../../../src/api/entities/sys/TypeRefs.js"; import {createCustomerInfo} from "../../../../src/api/entities/sys/TypeRefs.js";
import {createDnsRecord} from "../../../../src/api/entities/sys/TypeRefs.js"; import {createDnsRecord} from "../../../../src/api/entities/sys/TypeRefs.js";
import {DomainDnsStatus} from "../../../../src/settings/DomainDnsStatus"; import {DomainDnsStatus} from "../../../../src/settings/DomainDnsStatus.js";
import {AddDomainData} from "../../../../src/settings/emaildomain/AddDomainWizard"; import {AddDomainData} from "../../../../src/settings/emaildomain/AddDomainWizard.js";
import {createGroupInfo} from "../../../../src/api/entities/sys/TypeRefs.js"; import {createGroupInfo} from "../../../../src/api/entities/sys/TypeRefs.js";
const data: AddDomainData = { const data: AddDomainData = {

View file

@ -1,19 +1,19 @@
import o from "ospec" import o from "ospec"
import {DisplayMode, LoginState, LoginViewModel} from "../../../src/login/LoginViewModel" import {DisplayMode, LoginState, LoginViewModel} from "../../../src/login/LoginViewModel.js"
import type {LoginController} from "../../../src/api/main/LoginController" import type {LoginController} from "../../../src/api/main/LoginController.js"
import {createUser} from "../../../src/api/entities/sys/TypeRefs.js" import {createUser} from "../../../src/api/entities/sys/TypeRefs.js"
import type {IUserController} from "../../../src/api/main/UserController" import type {IUserController} from "../../../src/api/main/UserController.js"
import {createGroupInfo} from "../../../src/api/entities/sys/TypeRefs.js" import {createGroupInfo} from "../../../src/api/entities/sys/TypeRefs.js"
import {SecondFactorHandler} from "../../../src/misc/2fa/SecondFactorHandler" import {SecondFactorHandler} from "../../../src/misc/2fa/SecondFactorHandler.js"
import {assertThrows} from "@tutao/tutanota-test-utils" import {assertThrows} from "@tutao/tutanota-test-utils"
import type {CredentialsAndDatabaseKey, ICredentialsProvider, PersistentCredentials,} from "../../../src/misc/credentials/CredentialsProvider" import type {CredentialsAndDatabaseKey, ICredentialsProvider, PersistentCredentials,} from "../../../src/misc/credentials/CredentialsProvider.js"
import {KeyPermanentlyInvalidatedError} from "../../../src/api/common/error/KeyPermanentlyInvalidatedError" import {KeyPermanentlyInvalidatedError} from "../../../src/api/common/error/KeyPermanentlyInvalidatedError.js"
import {CredentialAuthenticationError} from "../../../src/api/common/error/CredentialAuthenticationError" import {CredentialAuthenticationError} from "../../../src/api/common/error/CredentialAuthenticationError.js"
import type {Credentials} from "../../../src/misc/credentials/Credentials" import type {Credentials} from "../../../src/misc/credentials/Credentials.js"
import {SessionType} from "../../../src/api/common/SessionType.js"; import {SessionType} from "../../../src/api/common/SessionType.js";
import {instance, matchers, object, replace, verify, when} from "testdouble" import {instance, matchers, object, replace, verify, when} from "testdouble"
import {AccessExpiredError, NotAuthenticatedError} from "../../../src/api/common/error/RestError" import {AccessExpiredError, NotAuthenticatedError} from "../../../src/api/common/error/RestError.js"
import {DatabaseKeyFactory} from "../../../src/misc/credentials/DatabaseKeyFactory" import {DatabaseKeyFactory} from "../../../src/misc/credentials/DatabaseKeyFactory.js"
const {anything} = matchers const {anything} = matchers

View file

@ -1,13 +1,13 @@
import o from "ospec" import o from "ospec"
import {_findMatchingRule, _matchesRegularExpression} from "../../../src/mail/model/InboxRuleHandler" import {_findMatchingRule, _matchesRegularExpression} from "../../../src/mail/model/InboxRuleHandler.js"
import type {InboxRule} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {InboxRule} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createInboxRule} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createInboxRule} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {EntityRestClientMock} from "../../api/worker/EntityRestClientMock" import {EntityRestClientMock} from "../api/worker/rest/EntityRestClientMock.js"
import {EntityClient} from "../../../src/api/common/EntityClient" import {EntityClient} from "../../../src/api/common/EntityClient.js"
import type {Mail} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {Mail} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createMail} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createMail} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createMailAddress} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {InboxRuleType} from "../../../src/api/common/TutanotaConstants" import {InboxRuleType} from "../../../src/api/common/TutanotaConstants.js"
o.spec("InboxRuleHandlerTest", function () { o.spec("InboxRuleHandlerTest", function () {
o.spec("Test _matchesRegularExpression", function () { o.spec("Test _matchesRegularExpression", function () {
o(" check invalid regular expressions", function () { o(" check invalid regular expressions", function () {

View file

@ -1,5 +1,5 @@
import o from "ospec" import o from "ospec"
import {knowledgeBaseSearch} from "../../../src/knowledgebase/model/KnowledgeBaseSearchFilter" import {knowledgeBaseSearch} from "../../../src/knowledgebase/model/KnowledgeBaseSearchFilter.js"
import type {KnowledgeBaseEntry} from "../../../src/api/entities/tutanota/TypeRefs.js" import type {KnowledgeBaseEntry} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createKnowledgeBaseEntry} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createKnowledgeBaseEntry} from "../../../src/api/entities/tutanota/TypeRefs.js"
import {createKnowledgeBaseEntryKeyword} from "../../../src/api/entities/tutanota/TypeRefs.js" import {createKnowledgeBaseEntryKeyword} from "../../../src/api/entities/tutanota/TypeRefs.js"

Some files were not shown because too many files have changed in this diff Show more