Skip to content

Commit 103231a

Browse files
Fix tests to match recent validation changes
Update tests to reflect two recent changes: 1. HTTP URLs are no longer accepted for image URIs (only HTTPS) 2. Custom avatar/header fields now show reservedKey error instead of avatarReserved since media record group was commented out - validateImageUri.test.ts: Update HTTP tests to expect errors - Profile.test.tsx: Update avatar validation test for reservedKey error 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2b17e47 commit 103231a

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/components/pages/profile/[name]/registration/steps/Profile/Profile.test.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,9 @@ describe('Profile', () => {
217217
)
218218
})
219219

220-
it('should show an error for duplicate label on custom avatar field if media avatar record exists', async () => {
220+
it('should show an error for reserved key on custom avatar field', async () => {
221221
const overrides = {
222222
records: [
223-
{
224-
key: 'avatar',
225-
value: 'https://example.com',
226-
type: 'text',
227-
group: 'media',
228-
},
229223
{
230224
key: 'avatar',
231225
value: 'https://example.com',
@@ -245,6 +239,6 @@ describe('Profile', () => {
245239
)
246240
await userEvent.click(screen.getByTestId('profile-submit-button'))
247241
await waitFor(() => expect(mockCallback).not.toHaveBeenCalled())
248-
expect(screen.getByText('steps.profile.errors.avatarReserved')).toBeInTheDocument()
242+
expect(screen.getByText('steps.profile.errors.reservedKey')).toBeInTheDocument()
249243
})
250244
})

src/validators/validateImageUri.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ describe('validateImageUri', () => {
1313
expect(validateImageUri(undefined)).toBe('Image URL is required')
1414
})
1515

16-
it('should return true for HTTP URLs', () => {
16+
it('should return error for HTTP URLs', () => {
1717
const result = validateImageUri('http://example.com/image.jpg')
18-
expect(result).toBe(true)
18+
expect(result).toBe('Image URL must use HTTPS protocol')
1919
})
2020

2121
it('should accept URLs with credentials', () => {
@@ -95,8 +95,8 @@ describe('isValidImageUri', () => {
9595
expect(isValidImageUri(undefined as any)).toBe(false)
9696
})
9797

98-
it('should return true for HTTP URLs', () => {
99-
expect(isValidImageUri('http://example.com/image.jpg')).toBe(true)
98+
it('should return false for HTTP URLs', () => {
99+
expect(isValidImageUri('http://example.com/image.jpg')).toBe(false)
100100
})
101101

102102
it('should return false for invalid URLs', () => {

0 commit comments

Comments
 (0)