master-zapier-plan-draft/packages/verae-nats-process/test/handle.test.js
George Lambert a32c91475c
Some checks are pending
offline / test (push) Waiting to run
Add overview repo and verae-nats-process expansion template
High-level system map with diagrams, TOC, and a docs index. Template
worker shows how to add a new verae.* address for search, storage, or
unplanned functions without teaching Zapier NATS.
2026-09-11 13:50:37 -04:00

21 lines
877 B
JavaScript

import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { handle } from '../src/handle.js';
import { SUBJECTS } from '../src/subjects.js';
describe('verae-nats-process template', () => {
it('uses the verae.area.resource.action address pattern', () => {
assert.equal(SUBJECTS.IN, 'verae.example.process.in');
assert.equal(SUBJECTS.OUT, 'verae.example.process.out');
assert.match(SUBJECTS.reply('abc'), /^verae\.example\.process\.reply\.abc$/);
});
it('handle requires correlation and is idempotent-shaped', () => {
assert.throws(() => handle({}), /correlationId/);
const a = handle({ correlationId: 'c1', payload: { q: 1 } });
const b = handle({ correlationId: 'c1', payload: { q: 1 } });
assert.equal(a.ok, true);
assert.equal(a.correlationId, b.correlationId);
assert.equal(a.echo.q, 1);
});
});