]> git.r.bdr.sh - rbdr/forum/commitdiff
Mock config for tests
authorRuben Beltran del Rio <redacted>
Thu, 22 Apr 2021 20:58:52 +0000 (22:58 +0200)
committerRuben Beltran del Rio <redacted>
Thu, 22 Apr 2021 20:58:52 +0000 (22:58 +0200)
Treat it as an external... also, deals better with the
vite meta things

jest.config.json
test_utils/config.js [new file with mode: 0644]

index 46f62f4a66b3befab4d25df0b985ecccfc9e23f2..3e47287cf185e0ad679317ecd570aa48116d6cc1 100644 (file)
@@ -4,11 +4,10 @@
     "^.+\\.svelte$": "svelte-jester"
   },
   "moduleNameMapper": {
+    "^\\$/config/config$": "<rootDir>/test_utils/config.js",
     "^\\$lib(.*)$": "<rootDir>/src/lib$1",
-    "^\\$app(.*)$": [".svelte/dev/runtime/app/*", ".svelte/build/runtime/app/*"]
-  },
-  "moduleFileExtensions": ["js", "svelte"],
-  "moduleNameMapper": {
+    "^\\$app(.*)$": [".svelte/dev/runtime/app/*", ".svelte/build/runtime/app/*"],
     "^\\$(.*)$": "<rootDir>/src$1"
-  }
+  },
+  "moduleFileExtensions": ["js", "svelte"]
 }
diff --git a/test_utils/config.js b/test_utils/config.js
new file mode 100644 (file)
index 0000000..4d58681
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * Mocking the configuration, since we're treating it as an external
+ */
+
+export const apollo = {
+  uri: 'http://MOCKED_CONFIG',
+  name: 'COOL_CLIENT',
+  version: '8.8.8'
+};
+
+export const version = '9.9.9';