Files
lindyson-ai/apps/api/tests/migration059.test.ts
T
Juno ChowandClaude Fable 5.1 f665082dad chore: 建立产品仓库,完成开源前的敏感信息清理
前端(Vite + React)、API/worker(Fastify + BullMQ)、api-contracts 契约包、
迁移脚本、测试与自托管 docker-compose 示例。

开源准备:运维脚本与机器信息已拆到私有仓库;公司名、备案号、隐私邮箱改读
publicCompliance.local.json(仓库只保留占位模板);站点地址与客服二维码改为
VITE_ 环境变量;fixtures 中的真实用户标识已匿名化;三个 package.json 标注
Apache-2.0。

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-16 02:10:46 +08:00

26 lines
949 B
TypeScript

import { readFile } from 'node:fs/promises';
import { describe, expect, it } from 'vitest';
const migrationUrl = new URL(
'../migrations/059_prompt_wizard_two_plan_batches.sql',
import.meta.url,
);
describe('059 提示词向导双方案批次迁移', () => {
it('替换已完成批次约束并同时兼容新双方案与历史三方案', async () => {
const sql = await readFile(migrationUrl, 'utf8');
expect(sql).toContain(
'DROP CONSTRAINT IF EXISTS prompt_wizard_batches_completed_shape_check',
);
expect(sql).toContain(
'ADD CONSTRAINT prompt_wizard_batches_completed_shape_check CHECK',
);
expect(sql).toContain("status <> 'completed'");
expect(sql).toContain('content_purged_at IS NOT NULL');
expect(sql).toContain("jsonb_typeof(plans) = 'array'");
expect(sql).toContain('jsonb_array_length(plans) IN (2, 3)');
expect(sql).not.toMatch(/UPDATE\s+prompt_wizard_batches/iu);
});
});