Files
Genarrative/apps/preview-deployer-web/src/validation.test.ts
T
kdletters 41874ab391
Project CI / Repository checks (push) Successful in 1m16s
Project CI / Frontend tests (push) Successful in 3m1s
Project CI / Backend tests (push) Successful in 4m2s
Project CI / Native shell tests (push) Successful in 17m2s
新增内网容器预览部署控制面
新增分支与指定提交的预览部署 SPA 和 Jenkins 代理服务
新增多实例 Docker 预览流水线、端口租约、实时健康状态和卸载能力
新增 /build 内网路由、systemd 部署资产和运维文档
修正容器 Nginx 健康检查探针
2026-08-15 17:18:10 +08:00

16 lines
619 B
TypeScript

import { expect, test } from 'vitest';
import { validateBranch, validateCommitHash } from './validation';
test('accepts normal branch names and rejects unsafe values', () => {
expect(validateBranch('feature/preview-panel')).toBe('');
expect(validateBranch('../master')).toBe('分支名格式不正确');
expect(validateBranch('feature;rm')).toBe('分支名格式不正确');
});
test('commit hash is optional but must be a git hash when present', () => {
expect(validateCommitHash('')).toBe('');
expect(validateCommitHash('a0242e35')).toBe('');
expect(validateCommitHash('not-a-hash')).not.toBe('');
});