Implemented the possibility ofa hidden user for playstore tests
Some checks failed
Code Analysis and Production Deploy / analyze (push) Failing after 5m40s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Has been skipped

This commit is contained in:
Torsten Schulz (local)
2026-06-09 11:32:00 +02:00
parent 300dce9835
commit 530e544542
11 changed files with 184 additions and 42 deletions

View File

@@ -19,7 +19,9 @@ vi.mock('../server/utils/auth.js', () => ({
verifyToken: vi.fn(),
getUserFromToken: vi.fn(),
readUsers: vi.fn().mockResolvedValue([]),
migrateUserRoles: vi.fn(user => user)
migrateUserRoles: vi.fn(user => user),
normalizeUserEmail: vi.fn(email => String(email || '').trim().toLowerCase()),
isHiddenUser: vi.fn(user => user?.hidden === true || user?.invisible === true || user?.isHidden === true || user?.systemAccount === true || user?.accountType === 'playstore_review')
}))
vi.mock('../server/utils/members.js', () => ({
@@ -264,5 +266,27 @@ describe('Spielplan, Mannschaften & öffentliche Endpoints', () => {
expect(result.birthdays).toHaveLength(0)
})
it('blendet unsichtbare Playstore-Benutzer auch für Vorstand aus', async () => {
const event = createEvent({ cookies: { auth_token: 'token' } })
const inDays = 7
const targetDate = new Date()
targetDate.setDate(targetDate.getDate() + inDays)
const geburtsdatum = `${targetDate.getFullYear() - 30}-${String(targetDate.getMonth() + 1).padStart(2, '0')}-${String(targetDate.getDate()).padStart(2, '0')}`
authUtils.verifyToken.mockReturnValue({ id: 'v1' })
authUtils.getUserFromToken.mockResolvedValue({ id: 'v1', roles: ['vorstand'], active: true })
authUtils.readUsers.mockResolvedValue([
{ id: 'u2', name: 'Playstore Review', email: 'review@club.de', active: true, geburtsdatum, accountType: 'playstore_review' }
])
memberUtils.readMembers.mockResolvedValue([
{ firstName: 'Play', lastName: 'Store', email: 'review@club.de', geburtsdatum, visibility: { showBirthday: true } }
])
const result = await birthdaysHandler(event)
expect(result.birthdays).toHaveLength(0)
})
})
})