import { describe, expect, it } from 'vitest';

import { adolescenceCatalog } from '../../../src/events/v2/catalog/adolescence.js';
import { educationCatalog } from '../../../src/events/v2/catalog/education.js';
import { adulthoodCatalog } from '../../../src/events/v2/catalog/adulthood.js';
import { eventCatalog } from '../../../src/events/v2/catalog/index.js';

describe('events v2 question catalog migration', () => {
  it('includes representative former v1 question events in the active v2 catalog', () => {
    const requiredQuestionIds = [
      'firstCrush',
      'groupProjectDrama',
      'chooseMajor',
      'reportCardDay',
      'firstJob',
      'workLifeBalance',
    ];

    for (const eventId of requiredQuestionIds) {
      expect(eventCatalog.some((definition) => definition.id === eventId)).toBe(true);
    }
  });

  it('uses non-empty choiceId values for all migrated question choices', () => {
    const combinedCatalog = [...adolescenceCatalog, ...educationCatalog, ...adulthoodCatalog];
    expect(combinedCatalog.length).toBeGreaterThan(0);

    for (const definition of combinedCatalog) {
      expect(definition.choices.length).toBeGreaterThan(1);
      for (const choice of definition.choices) {
        expect(choice.choiceId.length).toBeGreaterThan(0);
      }
    }
  });
});
