14 lines
517 B
TypeScript
14 lines
517 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import { mediaUrl, normalizeMediaUrl } from '@/spa/cmsMediaField'
|
|
|
|
describe('CMS media URLs', () => {
|
|
it('preserves Payload file endpoints used by production', () => {
|
|
expect(normalizeMediaUrl('/api/media/file/image%20(26).jpg')).toBe('/api/media/file/image%20(26).jpg')
|
|
})
|
|
|
|
it('builds a Payload file endpoint when only a filename is populated', () => {
|
|
expect(mediaUrl({ filename: 'image (26).jpg' }, '')).toBe('/api/media/file/image%20(26).jpg')
|
|
})
|
|
})
|