From: Ruben Beltran del Rio Date: Thu, 22 Apr 2021 20:58:52 +0000 (+0200) Subject: Mock config for tests X-Git-Url: https://git.r.bdr.sh/rbdr/forum/commitdiff_plain/2a37b2ec11c46fc87dae084bc0a7659b198311aa?ds=sidebyside;hp=4e6be9f49b9697d9577014b3ee2b7988129823a9 Mock config for tests Treat it as an external... also, deals better with the vite meta things --- diff --git a/jest.config.json b/jest.config.json index 46f62f4..3e47287 100644 --- a/jest.config.json +++ b/jest.config.json @@ -4,11 +4,10 @@ "^.+\\.svelte$": "svelte-jester" }, "moduleNameMapper": { + "^\\$/config/config$": "/test_utils/config.js", "^\\$lib(.*)$": "/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/*"], "^\\$(.*)$": "/src$1" - } + }, + "moduleFileExtensions": ["js", "svelte"] } diff --git a/test_utils/config.js b/test_utils/config.js new file mode 100644 index 0000000..4d58681 --- /dev/null +++ b/test_utils/config.js @@ -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';