Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
import { expect, test } from 'bun:test';
import { createEvaluatorPortV2, resolveEvaluatorPortV2 } from './index';
test('production profile requires an injected evaluator with no fallback', async () => {
expect(() => resolveEvaluatorPortV2(undefined, 'evaluator-required')).toThrow(
'Evaluator port is required',
);
const calls: string[] = [];
const injected = {
render: async (code: string) => {
calls.push(code);
return {} as never;
},
};
expect(resolveEvaluatorPortV2(injected, 'evaluator-required')).toBe(injected);
await resolveEvaluatorPortV2(injected, 'evaluator-required').render('source');
expect(calls).toEqual(['source']);
});
test('cancels transport work through a host signal without putting it on the wire', async () => {
const controller = new AbortController();
let calls = 0;
let observed: AbortSignal | undefined;
let wire = '';
const port = createEvaluatorPortV2(async (json, controls) => {
calls++;
observed = controls.signal;
wire = json;
return new Promise(() => {});
});
const work = port.render(
'function build() {}',
{},
{ signal: controller.signal, deadlineMs: 100 },
);
controller.abort();
await expect(work).rejects.toMatchObject({ code: 'CANCELLED' });
expect(observed?.aborted).toBe(true);
expect(wire).not.toContain('signal');
await expect(
port.render('function build() {}', {}, { signal: controller.signal }),
).rejects.toMatchObject({ code: 'CANCELLED' });
expect(calls).toBe(1);
});