mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[web] platform: adopt strict zod schema and extend test coverage GitOrigin-RevId: e3a0b7b4c52ac116f28be0d284284e3bd3994cda
28 lines
914 B
JavaScript
28 lines
914 B
JavaScript
import { describe, it, expect } from 'vitest'
|
|
import { bucketFileParamsSchema } from '../../../app/js/schemas.js'
|
|
|
|
describe('schemas', function () {
|
|
describe('bucketFileParamsSchema', function () {
|
|
it('accepts a well-formed bucket name', function () {
|
|
const result = bucketFileParamsSchema.safeParse({
|
|
params: { bucket: 'my-bucket-123', key: 'some/key' },
|
|
})
|
|
expect(result.success).to.equal(true)
|
|
})
|
|
|
|
it('rejects a bucket name with disallowed characters', function () {
|
|
const result = bucketFileParamsSchema.safeParse({
|
|
params: { bucket: 'My_Bucket!', key: 'some/key' },
|
|
})
|
|
expect(result.success).to.equal(false)
|
|
})
|
|
|
|
it('rejects an empty bucket name', function () {
|
|
const result = bucketFileParamsSchema.safeParse({
|
|
params: { bucket: '', key: 'some/key' },
|
|
})
|
|
expect(result.success).to.equal(false)
|
|
})
|
|
})
|
|
})
|