alepha
Version:
Easy-to-use modern TypeScript framework for building many kind of applications.
40 lines (36 loc) • 1.32 kB
text/typescript
import { Alepha } from "alepha";
import { describe, it } from "vitest";
import { AlephaOrmPostgres } from "../postgres/index.ts";
import {
testForceDelete,
testNoUpdateIfAlreadyDeleted,
testSoftDeleteUpdatesInsteadOfDelete,
} from "./deletedAt-tests.ts";
describe("deletedAt", () => {
it("should update instead of delete (sqlite)", async () => {
await testSoftDeleteUpdatesInsteadOfDelete(
Alepha.create({ env: { DATABASE_URL: "sqlite://:memory:" } }),
);
});
it("should update instead of delete (postgres)", async () => {
await testSoftDeleteUpdatesInsteadOfDelete(
Alepha.create().with(AlephaOrmPostgres),
);
});
it("should not update if deletedAt is already set (sqlite)", async () => {
await testNoUpdateIfAlreadyDeleted(
Alepha.create({ env: { DATABASE_URL: "sqlite://:memory:" } }),
);
});
it("should not update if deletedAt is already set (postgres)", async () => {
await testNoUpdateIfAlreadyDeleted(Alepha.create().with(AlephaOrmPostgres));
});
it("should force delete (sqlite)", async () => {
await testForceDelete(
Alepha.create({ env: { DATABASE_URL: "sqlite://:memory:" } }),
);
});
it("should force delete (postgres)", async () => {
await testForceDelete(Alepha.create().with(AlephaOrmPostgres));
});
});