Spaces:
Sleeping
Sleeping
| 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'] | |
| }); | |