Update docs

This commit is contained in:
Alan Grainger
2026-10-07 14:53:14 +13:00
parent b1dab610a4
commit daa099aca1
8 changed files with 69 additions and 99 deletions
+1 -18
View File
@@ -1,28 +1,11 @@
import { describe, it, expect, afterEach } from 'vitest'
import { basePathFrom, byteBudget, filenamePrefix, maxFileSize, notifyConfig } from '../src/config'
import { byteBudget, filenamePrefix, maxFileSize, notifyConfig } from '../src/config'
import { resetConfig, setConfig } from './helpers'
afterEach(resetConfig)
const MB = 1024 * 1024
describe('basePathFrom', () => {
it('is empty for an own-hostname deployment', () => {
expect(basePathFrom('https://upload.example.com')).toBe('')
expect(basePathFrom('https://upload.example.com/')).toBe('')
expect(basePathFrom(undefined)).toBe('')
})
it('is the URL path for a path-prefix deployment, without a trailing slash', () => {
expect(basePathFrom('https://photos.example.com/upload')).toBe('/upload')
expect(basePathFrom('https://photos.example.com/a/b/')).toBe('/a/b')
})
it('is empty for a value that is not a URL', () => {
expect(basePathFrom('not a url')).toBe('')
})
})
describe('upload options', () => {
it('has the documented defaults', () => {
expect(maxFileSize()).toBe(500 * MB)