From 9dc24a2a6c4b59471531712e6d0c36abfbe5b21f Mon Sep 17 00:00:00 2001 From: BacLuc Date: Sun, 17 Sep 2023 19:16:34 +0200 Subject: [PATCH] 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, + }, + }), }) }