Skip to content

test(tenancy): un-skip reportFirstDmSent POST assertion (#129)#151

Open
truffle-dev wants to merge 1 commit into
ghostwright:mainfrom
truffle-dev:fix/first-dm-sent-scalar-locals
Open

test(tenancy): un-skip reportFirstDmSent POST assertion (#129)#151
truffle-dev wants to merge 1 commit into
ghostwright:mainfrom
truffle-dev:fix/first-dm-sent-scalar-locals

Conversation

@truffle-dev

Copy link
Copy Markdown
Contributor

Closes #129.

The reportFirstDmSent "POSTs to /v1/tenant_status/first_dm_sent" test was left as test.todo after a Bun 1.3.13 CI flake: a closure-captured-array recorder reported expect(count).toBe(1) as 0, even though the structurally identical reportAgentReady sibling passed on the same runtime.

The sibling already sidesteps this by overriding globalThis.fetch with a plain async function that mutates only scalar locals, restored in a try/finally. This change mirrors that pattern for reportFirstDmSent so the first_dm_sent URL, method, content-type, and { slack_message_ts } body are actually asserted instead of skipped.

The remaining four reportFirstDmSent tests (empty-ts guard, non-2xx best-effort, fetch-rejection) were already real and untouched.

Verification on local Bun:

bun test src/tenancy/__tests__/heartbeat.test.ts
 8 pass
 0 fail
 16 expect() calls

bun run lint (biome) and bun run typecheck (tsc --noEmit) both clean.

)

The reportFirstDmSent "POSTs to /first_dm_sent" test was marked
test.todo after a Bun 1.3.13 CI flake where a closure-captured-array
recorder reported expect(count).toBe(1) as 0. The passing
reportAgentReady sibling already avoids this by overriding
globalThis.fetch with a plain async function that mutates only scalar
locals, restored in a try/finally. Mirror that exact pattern here so
the first_dm_sent body and headers are actually asserted rather than
skipped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tenancy/heartbeat: reportFirstDmSent test.todo at heartbeat.test.ts:131 — propose scalar-locals refactor matching sibling test

1 participant