Fix to set 'sendNotificationEmails' on admin of db init

- Set other missing properties on admin of db init.
- Additionally set default donations `progress` value to `7000` to have a better looking design on the news feed for devs and testers.
- Fix test in `pages/admin/donations.spec.js`.
This commit is contained in:
Wolfgang Huß 2021-09-29 10:32:51 +02:00
parent df4a5b7390
commit 49e4111def
7 changed files with 15 additions and 9 deletions

View File

@ -200,7 +200,7 @@ Factory.define('donations')
.attr('id', uuid)
.attr('showDonations', true)
.attr('goal', 15000)
.attr('progress', 0)
.attr('progress', 7000)
.after((buildObject, options) => {
return neode.create('Donations', buildObject)
})

View File

@ -35,6 +35,9 @@ const createDefaultAdminUser = async (session) => {
id: "${defaultAdmin.id}",
slug: "${defaultAdmin.slug}",
createdAt: toString(datetime()),
allowEmbedIframes: false,
showShoutsPublicly: false,
sendNotificationEmails: true,
deleted: false,
disabled: false
})-[:PRIMARY_EMAIL]->(e)`,

View File

@ -88,7 +88,7 @@ describe('donations', () => {
it('returns the current Donations info', async () => {
await expect(query({ query: donationsQuery, variables })).resolves.toMatchObject({
data: { Donations: { showDonations: true, goal: 15000, progress: 0 } },
data: { Donations: { showDonations: true, goal: 15000, progress: 7000 } },
errors: undefined,
})
})

View File

@ -91,9 +91,9 @@ const signupCypher = (inviteCode) => {
SET user.role = 'user'
SET user.createdAt = toString(datetime())
SET user.updatedAt = toString(datetime())
SET user.allowEmbedIframes = FALSE
SET user.showShoutsPublicly = FALSE
SET user.sendNotificationEmails = TRUE
SET user.allowEmbedIframes = false
SET user.showShoutsPublicly = false
SET user.sendNotificationEmails = true
SET email.verifiedAt = toString(datetime())
RETURN user {.*}
`

View File

@ -143,14 +143,16 @@ describe('donations.vue', () => {
it('calls mutation with input values once', async () => {
wrapper.find('#showDonations').trigger('click') // set to true
await wrapper.vm.$nextTick()
wrapper.find('#donations-goal').setValue('20000')
await wrapper.vm.$nextTick()
wrapper.find('#donations-progress').setValue('10000')
await wrapper.vm.$nextTick()
wrapper.find('.donations-info-button').trigger('submit')
await wrapper.vm.$nextTick()
await flushPromises()
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
expect.objectContaining({
variables: { showDonations: true, goal: 15000, progress: 0 },
variables: { showDonations: true, goal: 20000, progress: 10000 },
}),
)
})
@ -161,7 +163,7 @@ describe('donations.vue', () => {
expect(wrapper.vm.showDonations).toBe(false)
// wrapper.find('.donations-info-button').trigger('submit')
// await mocks.$apollo.mutate
// expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining({variables: { showDonations: false, goal: 15000, progress: 0 }}))
// expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining({variables: { showDonations: false, goal: 15000, progress: 7000 }}))
// expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1)
})

View File

@ -24,6 +24,7 @@
data-test="donations-goal"
/>
<ds-input
id="donations-progress"
class="donations-data"
model="progress"
:label="$t('admin.donations.progress')"

View File

@ -82,7 +82,7 @@ export default {
return {
showDonations: true,
goal: 15000,
progress: 0,
progress: 7000,
posts: [],
hasMore: true,
// Initialize your apollo data