Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -0,0 +1,44 @@
import { describe, expect, it } from "vitest";
import { isHoneypotTriggered } from "./honeypot.js";
import { HONEYPOT_FIELD_KEY } from "./schema.js";
/**
* Edge-case coverage for {@link isHoneypotTriggered}: the non-primitive
* fall-through branch and the numeric / boolean "looks empty" boundaries
* that decide whether a request is silently dropped.
*/
describe("isHoneypotTriggered — non-primitive values", () => {
it("treats an object value as a trigger (final fall-through branch)", () => {
// Bots that POST structured JSON into the hidden field still get flagged.
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: { nested: "x" } })).toBe(true);
});
it("treats an array value as a trigger", () => {
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: ["a", "b"] })).toBe(true);
});
});
describe("isHoneypotTriggered — numeric boundaries", () => {
it("does not trigger on a literal zero", () => {
// A numeric honeypot defaulting to 0 must not produce false positives.
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: 0 })).toBe(false);
});
it("triggers on a negative number", () => {
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: -1 })).toBe(true);
});
it("triggers on NaN (NaN !== 0)", () => {
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: Number.NaN })).toBe(true);
});
});
describe("isHoneypotTriggered — boolean / whitespace boundaries", () => {
it("does not trigger on boolean false", () => {
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: false })).toBe(false);
});
it("does not trigger on whitespace beyond plain spaces (tabs / newlines)", () => {
expect(isHoneypotTriggered({ [HONEYPOT_FIELD_KEY]: "\t\n \r" })).toBe(false);
});
});