import { describe, it, expect } from 'vitest';
import { hasProgress, initial, IntakeState } from './intake.machine';

const answering = initial as Extract<IntakeState, { tag: 'Answering' }>;

describe('intake hasProgress', () => {
  it('is false for a fresh questionnaire', () => {
    expect(hasProgress(answering)).toBe(false);
  });

  it('is true once an answer is given or the user advances', () => {
    expect(hasProgress({ ...answering, answers: { buitenlandGewerkt: 'ja' } })).toBe(true);
    expect(hasProgress({ ...answering, cursor: 1 })).toBe(true);
  });
});
