Files
FileHost/server/utils/content-type.test.ts
T
O96u 469d3be735
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
release: v1.2.0 — unified images/ storage and legacy migration
Consolidate local images under data/images/, add docker migrate CLI,
startup index sync with orphan cleanup, and remove upload folder UI/API.
2026-08-28 17:18:03 +08:00

16 lines
643 B
TypeScript

import { describe, expect, it } from 'vitest'
import { contentTypeFromKey } from './content-type'
describe('contentTypeFromKey', () => {
it('infers image types from extensions', () => {
expect(contentTypeFromKey('images/a.webp')).toBe('image/webp')
expect(contentTypeFromKey('images/file/111.webp')).toBe('image/webp')
expect(contentTypeFromKey('images/2026/08/28/123.webp')).toBe('image/webp')
expect(contentTypeFromKey('images/photo.JPG')).toBe('image/jpeg')
})
it('falls back to octet-stream for unknown extensions', () => {
expect(contentTypeFromKey('images/file.dat')).toBe('application/octet-stream')
})
})