chore(autonomous-session): consolidate uncommitted work from prior session
Bundles the prior autonomous-session output that was sitting unstaged: - Em-dash sweep across src/ + tests/ (en-dash/em-dash to hyphen, ~2280 instances) - country-flag-icons rollout (CountryFlag component, replaces emoji glyphs that never rendered on Windows; lazy-loads the 3x2 SVG index as a single chunk after the per-subpath dynamic-import approach silently failed in webpack) - Admin IA Phase 1+2: 7-domain regroup, 41 to 38 pages, /admin/berths index, redirects (ocr to ai, reports to dashboard, invitations to users), docs/admin-ia-proposal.md - Per-template email tester (registry + endpoint + UI on Email admin page) - Cancel-document mode picker (delete-from-Documenso vs keep-for-audit) - Dashboard PDF report: 25 widgets, SVG charts, date-range picker, 11 resolvers - Customize-widgets per-region sortables at xl+ (charts/rails/feed); single flat sortable below xl when the layout stacks; per-viewport saved orders - Audit doc updates capturing each shipped item - Lint fixes: react-compiler immutability in DonutChart (reduce instead of let-reassign), set-state-in-effect disables in CountryFlag and UploadForSigning preview-bytes effect, unused 'confirm' destructures in interest contract + reservation tabs, unescaped apostrophe in test-template card copy
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* EMAIL_REDIRECT_TO safety net — comprehensive verification.
|
||||
* EMAIL_REDIRECT_TO safety net - comprehensive verification.
|
||||
*
|
||||
* Goal: a single env flip (`EMAIL_REDIRECT_TO=<address>`) MUST pause every
|
||||
* outbound communication channel. This test file exercises each channel
|
||||
@@ -17,7 +17,7 @@ const REDIRECT_TARGET = 'redirect@example.test';
|
||||
// 1. Documenso recipient redirect (createDocument + generateDocumentFromTemplate)
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
describe('Documenso recipient redirect - EMAIL_REDIRECT_TO', () => {
|
||||
const originalRedirect = process.env.EMAIL_REDIRECT_TO;
|
||||
const originalDocumensoUrl = process.env.DOCUMENSO_API_URL;
|
||||
const originalDocumensoKey = process.env.DOCUMENSO_API_KEY;
|
||||
@@ -52,7 +52,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
vi.resetModules();
|
||||
});
|
||||
|
||||
it('createDocument — every recipient.email rewritten to redirect target', async () => {
|
||||
it('createDocument - every recipient.email rewritten to redirect target', async () => {
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
await mod.createDocument('Test Doc', 'pdf-base64', [
|
||||
@@ -70,7 +70,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('generateDocumentFromTemplate — formValues *Email keys rewritten', async () => {
|
||||
it('generateDocumentFromTemplate - formValues *Email keys rewritten', async () => {
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
await mod.generateDocumentFromTemplate(42, {
|
||||
@@ -89,7 +89,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
expect(callBody.formValues['client.fullName']).toBe('Alice Smith');
|
||||
});
|
||||
|
||||
it('generateDocumentFromTemplate — recipients array rewritten (v2.x shape)', async () => {
|
||||
it('generateDocumentFromTemplate - recipients array rewritten (v2.x shape)', async () => {
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
await mod.generateDocumentFromTemplate(42, {
|
||||
@@ -106,7 +106,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('sendDocument — short-circuited when redirect is set (no /send call)', async () => {
|
||||
it('sendDocument - short-circuited when redirect is set (no /send call)', async () => {
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
await mod.sendDocument('doc-1');
|
||||
@@ -118,7 +118,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
expect(sendCall).toBeUndefined();
|
||||
});
|
||||
|
||||
it('sendReminder — short-circuited when redirect is set (no /remind call)', async () => {
|
||||
it('sendReminder - short-circuited when redirect is set (no /remind call)', async () => {
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
await mod.sendReminder('doc-1', 'signer-1');
|
||||
@@ -126,7 +126,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
expect(fetchMock).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('createDocument — recipients NOT redirected when EMAIL_REDIRECT_TO unset', async () => {
|
||||
it('createDocument - recipients NOT redirected when EMAIL_REDIRECT_TO unset', async () => {
|
||||
delete process.env.EMAIL_REDIRECT_TO;
|
||||
vi.resetModules();
|
||||
const mod = await import('@/lib/services/documenso-client');
|
||||
@@ -143,7 +143,7 @@ describe('Documenso recipient redirect — EMAIL_REDIRECT_TO', () => {
|
||||
// 2. sendEmail redirect (covers the centralized path used by 5+ services)
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
describe('sendEmail redirect — EMAIL_REDIRECT_TO', () => {
|
||||
describe('sendEmail redirect - EMAIL_REDIRECT_TO', () => {
|
||||
const originalRedirect = process.env.EMAIL_REDIRECT_TO;
|
||||
|
||||
afterEach(() => {
|
||||
@@ -174,7 +174,7 @@ describe('sendEmail redirect — EMAIL_REDIRECT_TO', () => {
|
||||
}
|
||||
|
||||
// The mock is typed as `vi.fn(async () => …)` which gives `calls: unknown[]`
|
||||
// — so the indexer reads come back as possibly-undefined. The test arms
|
||||
// - so the indexer reads come back as possibly-undefined. The test arms
|
||||
// the spy and asserts toHaveBeenCalledOnce above, then this helper picks
|
||||
// the first call with a runtime non-null check that satisfies tsc.
|
||||
function firstSendMailArgs(spy: ReturnType<typeof vi.fn>): {
|
||||
@@ -198,7 +198,7 @@ describe('sendEmail redirect — EMAIL_REDIRECT_TO', () => {
|
||||
expect(args.subject).toMatch(/^\[redirected from alice@realclient\.com\] Welcome$/);
|
||||
});
|
||||
|
||||
it('handles array of recipients — joins original list into the subject prefix', async () => {
|
||||
it('handles array of recipients - joins original list into the subject prefix', async () => {
|
||||
const { sendMailMock, mod } = await setupWith(REDIRECT_TARGET);
|
||||
await mod.sendEmail(['alice@realclient.com', 'bob@realclient.com'], 'Update', '<p>x</p>');
|
||||
|
||||
@@ -223,7 +223,7 @@ describe('sendEmail redirect — EMAIL_REDIRECT_TO', () => {
|
||||
// 3. Webhook short-circuit (covers the per-port outbound webhook delivery)
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
describe('Webhook short-circuit — EMAIL_REDIRECT_TO', () => {
|
||||
describe('Webhook short-circuit - EMAIL_REDIRECT_TO', () => {
|
||||
// The actual webhook worker pulls from BullMQ + the DB. To keep this a
|
||||
// pure unit test, we extract the "should I dispatch?" predicate and
|
||||
// assert against env.EMAIL_REDIRECT_TO directly. The full integration
|
||||
|
||||
Reference in New Issue
Block a user