Spaces:
Sleeping
Sleeping
File size: 1,484 Bytes
720c6ed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | import assert from 'node:assert/strict';
import test from 'node:test';
import { randomUUID } from 'node:crypto';
const DIST_ROOT = new URL('../dist/src/', import.meta.url);
async function importFresh(relativePath) {
return import(new URL(`${relativePath}?t=${Date.now()}-${Math.random()}`, DIST_ROOT).href);
}
test('SupabaseSaver can be imported and initialized without crashing', async () => {
const { SupabaseSaver } = await importFresh('./agent/SupabaseSaver.js');
const saver = new SupabaseSaver();
assert.ok(saver);
assert.equal(typeof saver.getTuple, 'function');
assert.equal(typeof saver.put, 'function');
});
test('createAgentGraph wires SupabaseSaver successfully or falls back cleanly', async () => {
const { createAgentGraph } = await importFresh('./agent/graph.js');
// Default instantiation handles missing env vars without throwing unhandled exceptions
// because the Supabase client logic handles it or createAgentGraph catches it
const graph = createAgentGraph();
assert.ok(graph);
// Can explicitly configure checkpointer
const customGraph = createAgentGraph({ checkpointer: null });
assert.ok(customGraph);
});
test('createAgentGraph supports interruptBefore for Human-in-the-loop', async () => {
const { createAgentGraph } = await importFresh('./agent/graph.js');
const graph = createAgentGraph({ requireApproval: true, checkpointer: null });
assert.ok(graph);
// Internally this sets interruptBefore: ['tools']
});
|