From a2a983a5fdd203a93f94b26de0b87a4512f67feb Mon Sep 17 00:00:00 2001 From: BacLuc Date: Sun, 17 Sep 2023 18:57:47 +0200 Subject: [PATCH 1/3] Dashboard.spec.js: remove unecessary and duplicate loggedInUser from mocked vue data This fixes stderr | src/views/camp/__tests__/Dashboard.spec.js > Dashboard view > Renders View [Vue warn]: The computed property "loggedInUser" is already defined in data. --- frontend/src/views/camp/__tests__/Dashboard.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/camp/__tests__/Dashboard.spec.js b/frontend/src/views/camp/__tests__/Dashboard.spec.js index 22f05f6d06..9f94808c22 100644 --- a/frontend/src/views/camp/__tests__/Dashboard.spec.js +++ b/frontend/src/views/camp/__tests__/Dashboard.spec.js @@ -62,7 +62,6 @@ const DEFAULT_DASHBOARD_OPTIONS = () => ({ api: { reload: () => Promise.resolve() }, }, data: () => ({ - loggedInUser: USER, loading: false, filter: { period: null, From 6af8a067db4da2c98c04eb8d5d5e323c91eacb2f Mon Sep 17 00:00:00 2001 From: BacLuc Date: Sun, 17 Sep 2023 19:00:39 +0200 Subject: [PATCH 2/3] Dashboard.spec.js: fix $tc mock implementation This fixes the following warnings: [Vue warn]: Invalid prop: type check failed for prop "label". Expected String, got Undefined found in ---> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue [Vue warn]: Invalid prop: type check failed for prop "label". Expected String, got Undefined found in ---> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue [Vue warn]: Invalid prop: type check failed for prop "label". Expected String, got Undefined found in ---> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue [Vue warn]: Invalid prop: type check failed for prop "label". Expected String, got Undefined found in ---> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue --- frontend/src/views/camp/__tests__/Dashboard.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/camp/__tests__/Dashboard.spec.js b/frontend/src/views/camp/__tests__/Dashboard.spec.js index 9f94808c22..d6a5feb8f1 100644 --- a/frontend/src/views/camp/__tests__/Dashboard.spec.js +++ b/frontend/src/views/camp/__tests__/Dashboard.spec.js @@ -58,7 +58,7 @@ const DEFAULT_DASHBOARD_OPTIONS = () => ({ $auth: AUTH, $route: ROUTE(), $router: ROUTER(), - $tc: () => {}, + $tc: () => '', api: { reload: () => Promise.resolve() }, }, data: () => ({ From 9dc24a2a6c4b59471531712e6d0c36abfbe5b21f Mon Sep 17 00:00:00 2001 From: BacLuc Date: Sun, 17 Sep 2023 19:16:34 +0200 Subject: [PATCH 3/3] Dashboard.spec.js: fix mock in createCampWithRole This fixes the warnings happening in querySyncHelper.js: [Vue warn]: Error in mounted hook (Promise/async): "TypeError: Cannot read properties of undefined (reading 'allItems')" found in ---> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue TypeError: Cannot read properties of undefined (reading 'allItems') at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/helpers/querySyncHelper.js:146:37 at Array.map () at Module.loadAndProcessCollections (/home/lucius/projects/ecamp/ecamp3/main/frontend/src/helpers/querySyncHelper.js:146:6) at VueComponent.mounted (/home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue:373:1) --- .../views/camp/__tests__/Dashboard.spec.js | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/frontend/src/views/camp/__tests__/Dashboard.spec.js b/frontend/src/views/camp/__tests__/Dashboard.spec.js index d6a5feb8f1..e98272b576 100644 --- a/frontend/src/views/camp/__tests__/Dashboard.spec.js +++ b/frontend/src/views/camp/__tests__/Dashboard.spec.js @@ -38,6 +38,13 @@ const AUTH = { function createCampWithRole(role) { return () => ({ campCollaborations: () => ({ + _meta: { + self: '/campCollaborations?camp=%2Fapi%2Fcamps%2F6973c230d6b1', + load: Promise.resolve({ + allItems: [], + }), + loading: false, + }, items: [ { role: role, @@ -46,6 +53,42 @@ function createCampWithRole(role) { }, ], }), + categories: () => ({ + _meta: { + self: '/categories?camp=%2Fapi%2Fcamps%2F6973c230d6b1', + load: Promise.resolve({ + allItems: [], + }), + loading: false, + }, + }), + periods: () => ({ + _meta: { + self: '/periods?camp=%2Fapi%2Fcamps%2F6973c230d6b1', + load: Promise.resolve({ + allItems: [], + }), + loading: false, + }, + }), + progressLabels: () => ({ + _meta: { + self: '/progressLabels?camp=%2Fapi%2Fcamps%2F6973c230d6b1', + load: Promise.resolve({ + allItems: [], + }), + loading: false, + }, + }), + activities: () => ({ + _meta: { + self: '/activities?camp=%2Fapi%2Fcamps%2F6973c230d6b1', + load: Promise.resolve({ + allItems: [], + }), + loading: false, + }, + }), }) }