Files
lindyson-ai/apps/api/tests/bootstrapAdmin.test.ts
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

20 lines
911 B
TypeScript

import { readFile } from 'node:fs/promises';
import { describe, expect, it } from 'vitest';
describe('显式管理员初始化脚本', () => {
it('与基础 seed 分离且按北京时间初始化套餐日期', async () => {
const [bootstrapSource, seedSource] = await Promise.all([
readFile(new URL('../src/db/bootstrapAdmin.ts', import.meta.url), 'utf8'),
readFile(new URL('../src/db/seed.ts', import.meta.url), 'utf8'),
]);
expect(bootstrapSource).toContain("now() AT TIME ZONE 'Asia/Shanghai'");
expect(bootstrapSource).not.toContain('current_date');
expect(bootstrapSource).toContain('BOOTSTRAP_ADMIN_EMAIL');
expect(seedSource).not.toContain('BOOTSTRAP_ADMIN_EMAIL');
expect(seedSource).not.toContain('SEED_ADMIN_EMAIL');
expect(seedSource).not.toContain('DO UPDATE');
expect(seedSource.match(/DO NOTHING/g)?.length).toBeGreaterThanOrEqual(3);
});
});