import { buildSafeNotaryGateTransaction } from './omnl-safe-notary-gate-tx';

describe('omnl-safe-notary-gate-tx', () => {
  const root = process.env.PROXMOX_ROOT || process.cwd().replace(/\/smom-dbis-138\/services\/token-aggregation$/, '');

  beforeAll(() => {
    process.env.PROXMOX_ROOT = root;
  });

  it('builds Safe transaction when compliance configs exist', () => {
    const tx = buildSafeNotaryGateTransaction();
    if (!tx) {
      console.warn('Skipping: compliance configs not found at PROXMOX_ROOT');
      return;
    }
    expect(tx.chainId).toBe(138);
    expect(tx.safeAddress).toMatch(/^0x/i);
    expect(tx.transactions[0].data).toMatch(/^0x/);
    expect(tx.transactions[0].contractMethod.name).toBe('configureNotaryGate');
    expect(tx.threshold).toBeGreaterThanOrEqual(1);
    expect(tx.owners.length).toBeGreaterThanOrEqual(tx.threshold);
  });
});
