7d250ec342
Co-Authored-By: Claude Code <noreply@anthropic.com>
18 lines
759 B
TypeScript
18 lines
759 B
TypeScript
// services/api/test/reset.ts
|
|
// e2e 共用隔离工具:每个 e2e spec 的 beforeAll 调用 resetDb(),防止 spec 间
|
|
// 唯一约束冲突与脏数据。
|
|
// TODO(Task 8): 用 Prisma 实现 RESET_TABLES 中全部表的 truncate-if-exists
|
|
// (Task 8-10 逐步登记表名,届时空列表不再成立)。
|
|
// TODO(Task 11): 增加 MinIO `photo-live/dev` 前缀对象清理(同一函数内追加)。
|
|
export const RESET_TABLES: readonly string[] = [];
|
|
|
|
export async function resetDb(): Promise<void> {
|
|
if (RESET_TABLES.length === 0) {
|
|
// 尚未登记任何表(Task 8 前数据库无表):干净地跳过。
|
|
return;
|
|
}
|
|
throw new Error(
|
|
'resetDb: RESET_TABLES is non-empty but truncation is not implemented until Task 8',
|
|
);
|
|
}
|