Files
zerobyte/app/test/helpers/backup-mirror.ts
Nico 0e0eaea946 refactor: split backups module + unit tests (#463)
* refactor: split backups module

* test: backup execution

* test: schedule db
2026-02-03 23:00:25 +01:00

27 lines
722 B
TypeScript

import { db } from "~/server/db/db";
import { backupScheduleMirrorsTable, type BackupScheduleMirror } from "~/server/db/schema";
import { ensureTestOrganization } from "./organization";
type BackupScheduleMirrorInsert = Omit<BackupScheduleMirror, 'id' | 'createdAt'>;
export const createTestBackupScheduleMirror = async (
scheduleId: number,
repositoryId: string,
overrides: Partial<BackupScheduleMirrorInsert> = {},
) => {
await ensureTestOrganization();
const mirror = {
scheduleId,
repositoryId,
enabled: true,
lastCopyAt: null,
lastCopyStatus: null,
lastCopyError: null,
...overrides,
};
const data = await db.insert(backupScheduleMirrorsTable).values(mirror).returning();
return data[0];
};