Skip to main content
The shape: a handler is a function from a request to a response. Build the requests Gobare would send — the same body, the same headers, the same signature — and assert on what comes back. Stub the Gobare API the handler reads from, and nothing touches production. The suite below tests the Worker from Receive webhooks on Cloudflare Workers, but nothing in it is about Workers: any handler written as Request → Response drops in. It runs on Node’s built-in test runner with no dependencies.

The suite

Node 23.6 and later runs TypeScript directly; on earlier versions use npx tsx --test worker.test.ts.

Why each test is there

Each one is a mistake that passes every test you would think to write against your own code, because it fails only against a sender that is not you.

The fixtures

The payloads in the suite are the shapes Gobare sends. data always carries session_id, and never the object itself: The signature is HMAC-SHA256(secret, "{timestamp}.{body}") in hex, with the timestamp in milliseconds — see webhooks. sign() in the suite is that, and nothing else.

A real delivery, once

Fixtures prove your handler against the documented shape. Before going live, prove the documented shape against the real thing once: subscribe a request-capturing endpoint you control, run one session, and diff what arrives against your fixture. After that the fixtures carry the weight.

What was verified

The suite passes, 9 of 9, against the Worker as published. Separately, the Worker was sent deliveries signed by Gobare’s own signing function rather than this suite’s sign(), and accepted and rejected them identically — so the fixtures’ signatures are the real algorithm, not a copy that agrees with itself.

Next