release: v1.2.6 — 新 UI 体验优化与存储标识规则
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
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
This commit is contained in:
1 parent
ac65c1eb9d
commit
8408d01197
38 files changed
+491
-369
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
generateStorageBackendId,
|
||||
resolveObjectStorageIdPrefix
|
||||
} from './storage-backends'
|
||||
|
||||
describe('resolveObjectStorageIdPrefix', () => {
|
||||
it('uses explicit provider when given', () => {
|
||||
expect(resolveObjectStorageIdPrefix(
|
||||
{ endpoint: 'https://example.com' },
|
||||
'r2'
|
||||
)).toBe('r2')
|
||||
expect(resolveObjectStorageIdPrefix(
|
||||
{ endpoint: 'https://example.com' },
|
||||
'aws'
|
||||
)).toBe('s3')
|
||||
})
|
||||
|
||||
it('detects provider from endpoint', () => {
|
||||
expect(resolveObjectStorageIdPrefix({
|
||||
endpoint: 'https://abc123.r2.cloudflarestorage.com'
|
||||
})).toBe('r2')
|
||||
expect(resolveObjectStorageIdPrefix({
|
||||
endpoint: 'https://cos.ap-guangzhou.myqcloud.com'
|
||||
})).toBe('cos')
|
||||
expect(resolveObjectStorageIdPrefix({
|
||||
endpoint: 'https://oss-cn-hangzhou.aliyuncs.com'
|
||||
})).toBe('oss')
|
||||
expect(resolveObjectStorageIdPrefix({
|
||||
endpoint: 'https://s3.us-east-1.amazonaws.com'
|
||||
})).toBe('s3')
|
||||
})
|
||||
})
|
||||
|
||||
describe('generateStorageBackendId', () => {
|
||||
it('uses provider-specific prefix', () => {
|
||||
expect(generateStorageBackendId('r2')).toMatch(/^r2-[0-9a-f]{8}$/)
|
||||
expect(generateStorageBackendId('s3')).toMatch(/^s3-[0-9a-f]{8}$/)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user