Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/text.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-11-04 12:55:20 +0300
committerAzul <azul@riseup.net>2021-11-11 12:06:12 +0300
commited39392235a7fa21db7ed485be4fa08d9f22ff00 (patch)
treefa4ca49e840d094e96b0f9f2b1e6b3b72350738d /src/tests
parent7dc46f8cc3aa80df2defd031bb151d8cb835f6ae (diff)
Adjust jest setup
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/setup.js46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/tests/setup.js b/src/tests/setup.js
index a0332f45f..e659a31b2 100644
--- a/src/tests/setup.js
+++ b/src/tests/setup.js
@@ -20,9 +20,45 @@
*
*/
import '@babel/polyfill';
+import 'regenerator-runtime/runtime';
+import Vue from 'vue'
-export default async function () {
- global.OC = {
- requestToken: '123'
- }
-};
+global.t = jest.fn().mockImplementation((app, text) => text)
+global.n = jest.fn().mockImplementation((app, text) => text)
+
+global.OC = {
+ requestToken: '123',
+ webroot: '/nc-webroot',
+ coreApps: [
+ 'core',
+ ],
+ config: {
+ modRewriteWorking: true,
+ },
+ dialogs: {
+ },
+ isUserAdmin() {
+ return true
+ },
+ getLanguage() {
+ return 'en-GB'
+ },
+ getLocale() {
+ return 'en_GB'
+ },
+
+ MimeType: {
+ getIconUrl: jest.fn(),
+ },
+ L10N: {
+ translate: global.t,
+ }
+}
+
+global.OCA = {}
+
+
+Vue.prototype.t = global.t
+Vue.prototype.n = global.n
+Vue.prototype.OC = OC
+Vue.prototype.OCA = OCA