- 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
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
// Copyright (C) 2026 Bryan Joshua Pedini
|
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
export const UNKNOWN_API_OPERATION = 'api_unknown';
|
|
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 {
|
|
expect(json, `${what}: record delete answers its warnings`).toEqual({ warnings: expect.any(Array) });
|
|
}
|
|
|
|
export function bulkDeleteBody(deleted: number): Record<string, unknown> {
|
|
return expect.objectContaining({ deleted });
|
|
}
|
|
|
|
export function importApplyBody(added: number, updated: number, deleted: number): Record<string, unknown> {
|
|
return expect.objectContaining({ added, updated, deleted });
|
|
}
|
|
|
|
export function expectZoneCreateWarnings(json: unknown): void {
|
|
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 {
|
|
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));
|
|
});
|
|
}
|