Skip to content

Commit b454fc0

Browse files
committed
test(plugin-email): pay the spec load at module top, per check:test-source-alias
`check:test-source-alias` flagged the dynamic `import('@objectstack/spec/system')` inside a test body: this package resolves that specifier through `dist/`, so the first call transforms the dependency's whole module graph inside a clocked window. Hoisted to a module-scope import, where vitest clocks nothing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XpTx2tbq3pZRYAdoGt6E6Y
1 parent 83c8e4c commit b454fc0

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

packages/plugins/plugin-email/src/email-plugin.template-runtime-write.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import { describe, it, expect, vi } from 'vitest';
2929
import { assertEngineUpdateDispatch } from '@objectstack/objectql';
30+
import { EmailTemplateDefinitionSchema } from '@objectstack/spec/system';
3031
import { EmailServicePlugin } from './email-plugin.js';
3132

3233
const TABLE = 'sys_email_template';
@@ -415,14 +416,12 @@ describe('#16152 read-decoration strip uses the shared list, not a blanket `_` s
415416
_lockDocsUrl: 'https://example.invalid/locks',
416417
} as const;
417418

418-
it('the schema declares the ADR-0010 envelope and rejects the read decorations', async () => {
419+
it('the schema declares the ADR-0010 envelope and rejects the read decorations', () => {
419420
// The premise the deleted docblock got backwards, asserted directly
420421
// against the schema rather than inferred from it. `email-template.zod.ts`
421422
// spreads `MetadataProtectionFields` into its `strictObject`, so every
422423
// envelope key is authorable surface here; `_diagnostics` / `_draft` are
423424
// not declared anywhere in that shape, which is why they must be stripped.
424-
const { EmailTemplateDefinitionSchema } = await import('@objectstack/spec/system');
425-
426425
const withEnvelope = EmailTemplateDefinitionSchema.safeParse({ ...template(), ...ENVELOPE });
427426
expect(withEnvelope.success).toBe(true);
428427
// Guarding a KEY's reachability: no `unrecognized_keys` on any envelope key.

0 commit comments

Comments
 (0)