Version 1.0.0 — Freigabe für den Echtbetrieb (#17)
This commit was merged in pull request #17.
This commit is contained in:
@@ -43,6 +43,15 @@ beforeAll(async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Erst aufraeumen, dann anlegen.
|
||||
//
|
||||
// Aufraeumen nur am Ende reicht nicht: bricht ein Lauf ab — abgebrochene
|
||||
// Sitzung, Fehler in einer anderen Datei, geschlossenes Terminal —, bleiben
|
||||
// die Datensaetze stehen und der naechste Lauf scheitert an einer
|
||||
// Eindeutigkeit, die mit dem Geprueften nichts zu tun hat. Das kostet dann
|
||||
// zehn Minuten Fehlersuche an der falschen Stelle.
|
||||
await aufraeumen();
|
||||
|
||||
const a = await system.organisation.upsert({
|
||||
where: { slug: SLUG_A },
|
||||
update: {},
|
||||
@@ -91,14 +100,17 @@ beforeAll(async () => {
|
||||
konto = benutzer.id;
|
||||
});
|
||||
|
||||
/** Alles entfernen, was dieser Test anlegt. */
|
||||
async function aufraeumen(): Promise<void> {
|
||||
await system.$transaction(async (tx) => {
|
||||
await tx.$executeRaw`SELECT set_config('app.audit_bereinigung', 'an', true)`;
|
||||
await tx.benutzer.deleteMany({ where: { email: { endsWith: "@test-mandant.de" } } });
|
||||
await tx.organisation.deleteMany({ where: { slug: { in: [SLUG_A, SLUG_B] } } });
|
||||
});
|
||||
}
|
||||
|
||||
afterAll(async () => {
|
||||
if (erreichbar) {
|
||||
await system.$transaction(async (tx) => {
|
||||
await tx.$executeRaw`SELECT set_config('app.audit_bereinigung', 'an', true)`;
|
||||
await tx.benutzer.deleteMany({ where: { email: { endsWith: "@test-mandant.de" } } });
|
||||
await tx.organisation.deleteMany({ where: { slug: { in: [SLUG_A, SLUG_B] } } });
|
||||
});
|
||||
}
|
||||
if (erreichbar) await aufraeumen();
|
||||
await system.$disconnect();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user