mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-14 17:43:04 +00:00
Deliver self-service forgot/reset via Resend, logged-in password change, and optional avatar on /campanha/perfil; register post-simplify engineering debts as RS+.
37 lines
1 KiB
TypeScript
37 lines
1 KiB
TypeScript
// @vitest-environment node
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
assertCampaignAvatarFile,
|
|
campaignUserInitials,
|
|
campaignUserShellView,
|
|
mediaDocumentUrl,
|
|
} from '@/utilities/campaignUserProfile'
|
|
|
|
describe('campaignUserProfile helpers', () => {
|
|
it('builds initials from the user name', () => {
|
|
expect(campaignUserInitials('Maria Silva')).toBe('MS')
|
|
expect(campaignUserInitials('João')).toBe('J')
|
|
})
|
|
|
|
it('builds shell view from a campaign user', () => {
|
|
expect(
|
|
campaignUserShellView({
|
|
name: 'Maria',
|
|
role: 'geral',
|
|
avatar: { id: 1, url: 'https://example.com/a.jpg' } as never,
|
|
}),
|
|
).toEqual({
|
|
name: 'Maria',
|
|
role: 'geral',
|
|
avatarUrl: 'https://example.com/a.jpg',
|
|
})
|
|
expect(mediaDocumentUrl(42)).toBeNull()
|
|
})
|
|
|
|
it('rejects unsupported avatar mime types', () => {
|
|
const file = new File(['x'], 'avatar.gif', { type: 'image/gif' })
|
|
expect(() => assertCampaignAvatarFile(file)).toThrow(/JPEG, PNG ou WebP/)
|
|
})
|
|
})
|