test: require review fix assertions

- test: require review fix assertions
- test: cover zone repair and imported dns records
- test: wait for dns and tighten assertions
- fix(api): drop the record id of a rolled back record creation
- test(audit): run every api route through the real handlers in an audit matrix
- test(api): run the authorization matrix through the real zone handlers
- test: repair duplicate apex soa through ui
This commit is contained in:
bryanpedini committed 2026-11-19 15:46:12 +01:00
1 parent a884219512
commit 9251c85fd8
14 files changed
+1631 -123

No files matched your search

+5 -8
View File
@@ -3,15 +3,13 @@
import { expect } from '@playwright/test';
export const REVIEW_FIXES: boolean = process.env.E2E_REVIEW_FIXES === 'enabled';
export const UNKNOWN_API_OPERATION = 'api_unknown';
export const UNKNOWN_API_ROW_COUNT = REVIEW_FIXES ? 1 : 0;
export const RECORD_DELETE_STATUS = REVIEW_FIXES ? 200 : 204;
export const ZONE_CREATE_DELEGATIONS_IN = REVIEW_FIXES ? 'before' : 'any';
export const UNKNOWN_API_ROW_COUNT = 1;
export const RECORD_DELETE_STATUS = 200;
export const ZONE_CREATE_DELEGATIONS_IN = 'before';
export function expectRecordDeleteBody(json: unknown, what: string): void {
if (REVIEW_FIXES) expect(json, `${what}: record delete answers its warnings`).toEqual({ warnings: expect.any(Array) });
expect(json, `${what}: record delete answers its warnings`).toEqual({ warnings: expect.any(Array) });
}
export function bulkDeleteBody(deleted: number): Record<string, unknown> {
@@ -23,11 +21,10 @@ export function importApplyBody(added: number, updated: number, deleted: number)
}
export function expectZoneCreateWarnings(json: unknown): void {
if (REVIEW_FIXES) expect((json as { warnings?: unknown }).warnings, 'zone create answers its warnings').toEqual(expect.any(Array));
expect((json as { warnings?: unknown }).warnings, 'zone create answers its warnings').toEqual(expect.any(Array));
}
export function expectCheckErrorRowsCarryRaw(rows: Array<{ data: unknown; raw: string | null; problems: Array<{ severity: string }> }>, contentOf: (index: number) => string | null): void {
if (!REVIEW_FIXES) return;
rows.forEach((r, i) => {
if (r.problems.some((p) => p.severity === 'error')) expect(r.raw, 'a row with a check error carries its stored content in raw').toBe(contentOf(i));
});
+2 -6
View File
@@ -3,7 +3,7 @@
import { expect } from '@playwright/test';
import type { AuditRow, Db } from './mysql';
import { REVIEW_FIXES, UNKNOWN_API_OPERATION } from './decisions';
import { UNKNOWN_API_OPERATION } from './decisions';
import type { SecretRegistry } from './secrets';
export const READ_OPERATIONS = new Set([
@@ -208,11 +208,7 @@ export class AuditLedger {
return;
}
if (!route || x.status === 405) {
this.add(
REVIEW_FIXES
? { operation: UNKNOWN_API_OPERATION, status: x.status, actor: x.actor, origin: x.origin, userIsActor: true, error: errorOf(x.body) ?? undefined, optional: false, source: x.source }
: { operation: '*', status: x.status, actor: x.actor, origin: x.origin, userIsActor: true, optional: true, source: x.source },
);
this.add({ operation: UNKNOWN_API_OPERATION, status: x.status, actor: x.actor, origin: x.origin, userIsActor: true, error: errorOf(x.body) ?? undefined, optional: false, source: x.source });
return;
}
const ok = x.status < 400;