Skip to content

Commit

Permalink
Dashboard.spec.js: fix mock in createCampWithRole
Browse files Browse the repository at this point in the history
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

---> <Dashboard> at /home/lucius/projects/ecamp/ecamp3/main/frontend/src/views/camp/Dashboard.vue
       <Root>
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 (<anonymous>)
    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)
  • Loading branch information
BacLuc committed Sep 19, 2023
1 parent 6af8a06 commit 9dc24a2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions frontend/src/views/camp/__tests__/Dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
},
}),
})
}

Expand Down

0 comments on commit 9dc24a2

Please sign in to comment.