mirror of
https://github.com/nicotsx/zerobyte.git
synced 2026-02-18 14:56:35 -05:00
* test: backups service * refactor: create hono app in a separate file To avoid side effects like db migration or startup scripts when testing test(backups): add security tests to the backups controller * ci: run typechecks, build and tests on PR * test: controllers security tests * chore: update lock file * refactor: pr feedbacks
22 lines
608 B
TypeScript
22 lines
608 B
TypeScript
import { db } from "~/server/db/db";
|
|
import { faker } from "@faker-js/faker";
|
|
import { volumesTable, type VolumeInsert } from "~/server/db/schema";
|
|
|
|
export const createTestVolume = async (overrides: Partial<VolumeInsert> = {}) => {
|
|
const volume: VolumeInsert = {
|
|
name: faker.system.fileName(),
|
|
config: {
|
|
backend: "directory",
|
|
path: `/mnt/volumes/${faker.system.fileName()}`,
|
|
},
|
|
status: "mounted",
|
|
autoRemount: true,
|
|
shortId: faker.string.alphanumeric(6),
|
|
type: "directory",
|
|
...overrides,
|
|
};
|
|
|
|
const data = await db.insert(volumesTable).values(volume).returning();
|
|
return data[0];
|
|
};
|