aboutsummaryrefslogtreecommitdiffstats
path: root/__mocks__
diff options
context:
space:
mode:
Diffstat (limited to '__mocks__')
-rw-r--r--__mocks__/@nextcloud/auth.ts17
-rw-r--r--__mocks__/@nextcloud/axios.ts17
-rw-r--r--__mocks__/@nextcloud/capabilities.ts22
-rw-r--r--__mocks__/@nextcloud/dialogs.ts13
-rw-r--r--__mocks__/@nextcloud/initial-state.ts8
-rw-r--r--__mocks__/css.js5
-rw-r--r--__mocks__/svg.js5
-rw-r--r--__mocks__/webdav.ts10
8 files changed, 97 insertions, 0 deletions
diff --git a/__mocks__/@nextcloud/auth.ts b/__mocks__/@nextcloud/auth.ts
new file mode 100644
index 00000000000..8d341dadad7
--- /dev/null
+++ b/__mocks__/@nextcloud/auth.ts
@@ -0,0 +1,17 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+export const getCurrentUser = function() {
+ return {
+ uid: 'test',
+ displayName: 'Test',
+ isAdmin: false,
+ }
+}
+
+export const getRequestToken = function() {
+ return 'test-token-1234'
+}
+
+export const onRequestTokenUpdate = function() {}
diff --git a/__mocks__/@nextcloud/axios.ts b/__mocks__/@nextcloud/axios.ts
new file mode 100644
index 00000000000..5133574d9ed
--- /dev/null
+++ b/__mocks__/@nextcloud/axios.ts
@@ -0,0 +1,17 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+export default {
+ interceptors: {
+ response: {
+ use: () => {},
+ },
+ request: {
+ use: () => {},
+ },
+ },
+ get: async () => ({ status: 200, data: {} }),
+ delete: async () => ({ status: 200, data: {} }),
+ post: async () => ({ status: 200, data: {} }),
+}
diff --git a/__mocks__/@nextcloud/capabilities.ts b/__mocks__/@nextcloud/capabilities.ts
new file mode 100644
index 00000000000..b2b33773403
--- /dev/null
+++ b/__mocks__/@nextcloud/capabilities.ts
@@ -0,0 +1,22 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+import type { Capabilities } from '../../apps/files/src/types'
+
+export const getCapabilities = (): Capabilities => {
+ return {
+ files: {
+ bigfilechunking: true,
+ blacklisted_files: [],
+ forbidden_filename_basenames: [],
+ forbidden_filename_characters: [],
+ forbidden_filename_extensions: [],
+ forbidden_filenames: [],
+ undelete: true,
+ version_deletion: true,
+ version_labeling: true,
+ versioning: true,
+ },
+ }
+}
diff --git a/__mocks__/@nextcloud/dialogs.ts b/__mocks__/@nextcloud/dialogs.ts
new file mode 100644
index 00000000000..54705735508
--- /dev/null
+++ b/__mocks__/@nextcloud/dialogs.ts
@@ -0,0 +1,13 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { vi } from 'vitest'
+
+export const showMessage = vi.fn()
+export const showSuccess = vi.fn()
+export const showWarning = vi.fn()
+export const showInfo = vi.fn()
+export const showError = vi.fn()
+export const showUndo = vi.fn()
diff --git a/__mocks__/@nextcloud/initial-state.ts b/__mocks__/@nextcloud/initial-state.ts
new file mode 100644
index 00000000000..a562259b93f
--- /dev/null
+++ b/__mocks__/@nextcloud/initial-state.ts
@@ -0,0 +1,8 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+export const loadState = function(app: string, key: string, fallback?: any) {
+ return fallback
+}
diff --git a/__mocks__/css.js b/__mocks__/css.js
new file mode 100644
index 00000000000..152c532f313
--- /dev/null
+++ b/__mocks__/css.js
@@ -0,0 +1,5 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+export default {}
diff --git a/__mocks__/svg.js b/__mocks__/svg.js
new file mode 100644
index 00000000000..70674e5a0d0
--- /dev/null
+++ b/__mocks__/svg.js
@@ -0,0 +1,5 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+export default '<svg>SvgMock</svg>'
diff --git a/__mocks__/webdav.ts b/__mocks__/webdav.ts
new file mode 100644
index 00000000000..7f56c7000b0
--- /dev/null
+++ b/__mocks__/webdav.ts
@@ -0,0 +1,10 @@
+/**
+ * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+export const createClient = () => {}
+export const getPatcher = () => {
+ return {
+ patch: () => {}
+ }
+}