import { describe, expect, it } from 'vitest';
import { runSet96Canary } from '../scripts/set96-canary';
import { TIER1_DEFAULT_GATES } from '../src/tier1/runner';

describe('SET 96b — candidate-zero fold canary', () => {
  it('keeps the fold default-off and records a baseline candidate-zero rate', async () => {
    expect(TIER1_DEFAULT_GATES.set96bFoldWatcherIntoCandidate0).toBe(false);

    const result = await runSet96Canary();
    expect(result.a.total).toBeGreaterThan(0);
    expect(result.a.accepted).toBeLessThanOrEqual(result.a.total);
  });

  it('documents SKIP without failing when B loses more than five points', async () => {
    const result = await runSet96Canary();
    const aRate = result.a.accepted / result.a.total;
    const bRate = result.b.accepted / result.b.total;

    if (bRate < aRate - 0.05) {
      expect(result.verdict).toBe('SKIP');
      return;
    }
    expect(result.verdict).toBe('SHIP');
  });
});
