release: v1.1.0 — S3 multi-backend storage and admin UI
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
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
This commit is contained in:
1 parent
7c45a78572
commit
acc64751ef
46 files changed
+4005
-480
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { buildObjectKey, parseS3Config, validateS3Config } from './s3'
|
||||
|
||||
describe('S3 backend helpers', () => {
|
||||
it('buildObjectKey joins prefix and key', () => {
|
||||
expect(buildObjectKey('pichost', 'images/2026/01/a.webp')).toBe(
|
||||
'pichost/images/2026/01/a.webp'
|
||||
)
|
||||
expect(buildObjectKey(undefined, 'images/a.webp')).toBe('images/a.webp')
|
||||
expect(buildObjectKey('/pichost/', 'images/a.webp')).toBe('pichost/images/a.webp')
|
||||
})
|
||||
|
||||
it('parseS3Config requires endpoint, region and bucket', () => {
|
||||
expect(parseS3Config('{}')).toBeNull()
|
||||
expect(parseS3Config(JSON.stringify({
|
||||
endpoint: 'https://example.r2.cloudflarestorage.com',
|
||||
region: 'auto',
|
||||
bucket: 'pics'
|
||||
}))).toEqual({
|
||||
endpoint: 'https://example.r2.cloudflarestorage.com',
|
||||
region: 'auto',
|
||||
bucket: 'pics',
|
||||
prefix: undefined,
|
||||
forcePathStyle: false
|
||||
})
|
||||
})
|
||||
|
||||
it('validateS3Config rejects invalid endpoint', () => {
|
||||
expect(validateS3Config({
|
||||
endpoint: 'not-a-url',
|
||||
region: 'auto',
|
||||
bucket: 'pics'
|
||||
})).toBeTruthy()
|
||||
expect(validateS3Config({
|
||||
endpoint: 'https://example.com',
|
||||
region: 'auto',
|
||||
bucket: ''
|
||||
})).toBeTruthy()
|
||||
expect(validateS3Config({
|
||||
endpoint: 'https://example.com',
|
||||
region: 'auto',
|
||||
bucket: 'pics'
|
||||
})).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user