Skip to content

test(agent): add growth-hook coverage for claim/drip/splitSend event slugs #270

Description

@rz1989s

Background

Final holistic review of PR-E (#269) flagged that growth-hook.test.ts only exercises the send and swap tool paths. The remaining three slugs from TOOL_EVENT_MAP have no test coverage:

  • sipher_private_claim_completed (mapped from claim)
  • sipher_recurring_send_tick (mapped from drip)
  • sipher_batch_send_completed (mapped from splitSend)

If any of these mapping keys ever get a typo (e.g., splitSendsplit_send), no test catches it. The fix is mechanical — 3 lines of it.each parametric coverage.

Why it wasn't fixed in PR-E

Two reasons:

  1. Scope discipline. PR-E was the canonical-contract rewrite, not a test-coverage expansion.
  2. Practical impact gated by sipher#262. claim/drip/splitSend (and send/swap) currently return {status: 'awaiting_signature'} with no tx_signature, so the growth-hook silently no-ops for all of them. Only claim actually emits events today (it forwards its input deposit-tx-signature). The other 4 slugs are dead-on-arrival until sipher#262 is resolved.

So the coverage gap is real but the practical risk is low until #262 ships.

Suggested fix

Inside packages/agent/tests/integrations/torque/growth-hook.test.ts, add a parametric block:

```typescript
describe.each([
{ tool: 'claim', slug: 'sipher_private_claim_completed' },
{ tool: 'drip', slug: 'sipher_recurring_send_tick' },
{ tool: 'splitSend', slug: 'sipher_batch_send_completed' },
])('emits $slug for $tool tool', ({ tool, slug }) => {
it('builds correct event shape', async () => {
baseExecutor.mockResolvedValue({ action: tool, status: 'confirmed', signature: TX_SIG })
const wrapped = wrapExecutorWithGrowthHook(baseExecutor, opts)
await wrapped(tool, { wallet: WALLET, amount: 1, token: 'SOL', recipient: 'rector.sol' })
await new Promise((resolve) => setTimeout(resolve, 0))
expect(emitEventMock).toHaveBeenCalledWith(
expect.objectContaining({ eventName: slug })
)
})
})
```

Three tests, locks the slug mapping.

Priority

Low. Defer until either:

  • sipher#262 ships (then these tools actually emit and coverage matters more)
  • A general test-hygiene sweep happens

Context

PR-E #269 final holistic review, Minor issue #3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions