import { describe, expect, it, vi } from 'vitest'; import { databricksSqlReadTool } from '@fabric-harness/databricks'; describe('generated Databricks safe-tool boundary', () => { it('allows one SELECT and rejects mutation before Statement Execution', async () => { const executeStatement = vi.fn(async () => ({ status: { state: 'SUCCEEDED' } })); const tool = databricksSqlReadTool({ executeStatement }, { warehouseId: 'mock-warehouse' }); await expect(tool.execute?.({ statement: 'SELECT plan, count(*) FROM fixture GROUP BY plan' })).resolves.toBeTruthy(); executeStatement.mockClear(); await expect(tool.execute?.({ statement: 'DROP TABLE main.prod.customer' })).rejects.toThrow(/only SELECT|unsafe keyword/); expect(executeStatement).not.toHaveBeenCalled(); }); });