test: tighten gateway logging string assertions

This commit is contained in:
Peter Steinberger
2026-05-08 14:35:32 +01:00
parent a44021ce17
commit 2806e22caa
3 changed files with 3 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ async function createNoisyPngBuffer(width: number, height: number): Promise<Buff
}
function requireAttachmentIdFromUrl(url: unknown): string {
expect(url).toEqual(expect.any(String));
expect(url).toBeTypeOf("string");
const attachmentId = String(url).split("/").at(-2);
if (!attachmentId) {
throw new Error(`expected attachment id in URL ${String(url)}`);

View File

@@ -85,7 +85,7 @@ async function createFreshOperatorDevice(scopes: string[], nonce: string) {
async function connectOperator(ws: GatewaySocket, scopes: string[]) {
const nonce = await readConnectChallengeNonce(ws);
expect(nonce).toEqual(expect.any(String));
expect(nonce).toBeTypeOf("string");
expect(String(nonce).length).toBeGreaterThan(0);
await connectOk(ws, {
token: "secret",

View File

@@ -149,7 +149,7 @@ describe("file log redaction", () => {
const [line] = fs.readFileSync(logPath, "utf8").trim().split("\n");
const record = JSON.parse(line ?? "{}") as Record<string, unknown>;
expect(record.hostname).toEqual(expect.any(String));
expect(record.hostname).toBeTypeOf("string");
expect(record.hostname).not.toBe("");
expect(record.message).toBe("request completed");
});