mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:21:13 +00:00
* Type page props, hook state and helper parameters from their call sites First pass of the strict typing of components/pages (About to cloudfam): destructured props get an interface built from the JSX that renders them, refs and state get their element and value types, plain parameters get the type their callers or body fix. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type pages (careers, calculator, blog, brand, cli) from their data and call sites Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the cloud pages from their scenes and hooks Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * wip * Type the remaining pages under strict Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
24 lines
1.2 KiB
TypeScript
24 lines
1.2 KiB
TypeScript
// node --test components/pages/BetaApply.send.test.mjs: an application is sent as hanzo.ai sends it (portal.tsx `file`).
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { filing, said } from './BetaApply.send.ts';
|
|
|
|
const asks = [{ id: 'builds' }, { id: 'cadence' }, { id: 'blurb' }, { id: 'company' }];
|
|
|
|
test('a program\'s answers go to its own form, one field per answered question', () => {
|
|
const sent = filing('research', asks, { builds: ['Web apps', 'AI agents'], cadence: 'Every day', blurb: ' ', company: ' Acme ' }, 1794000000000);
|
|
assert.ok(sent);
|
|
assert.equal(sent.url, 'https://api.hanzo.ai/v1/form/public/hanzo.research-apply/responses');
|
|
assert.deepEqual(sent.body, {
|
|
token: 'b_1794000000000',
|
|
answers: [{ field: 'builds', text: 'Web apps, AI agents' }, { field: 'cadence', text: 'Every day' }, { field: 'company', text: 'Acme' }],
|
|
hidden: { program: 'research', source: 'hanzo.ai/beta' },
|
|
});
|
|
});
|
|
|
|
test('an answer is cut at 2,000 characters, and nothing answered sends nothing', () => {
|
|
assert.equal(filing('beta', asks, { blurb: 'x'.repeat(2500) })?.body.answers[0].text.length, 2000);
|
|
assert.equal(filing('partner', asks, { builds: [], blurb: ' ' }), null);
|
|
assert.equal(said(undefined), '');
|
|
});
|