import React from 'react';
import { render, screen } from '@testing-library/react';
import ResultsDisplay from './ResultsDisplay';
import { Decision } from '../hooks/useSession';

describe('ResultsDisplay Refactor', () => {
    it('should render all categories correctly', () => {
        const decision: Decision = {
            goTo: 'Everyone wants Pizza.',
            alsoGood: 'Many people are okay with Pasta.',
            considerable: 'Burgers are an option for some.',
            noGoes: 'No one wants Salad.',
            needsDiscussion: 'There is a conflict regarding Tacos.',
        };

        render(<ResultsDisplay decision={decision} />);

        expect(screen.getByText('Go-to')).toBeInTheDocument();
        expect(screen.getByText('Everyone wants Pizza.')).toBeInTheDocument();

        expect(screen.getByText('Also good')).toBeInTheDocument();
        expect(screen.getByText('Many people are okay with Pasta.')).toBeInTheDocument();

        expect(screen.getByText('Considerable')).toBeInTheDocument();
        expect(screen.getByText('Burgers are an option for some.')).toBeInTheDocument();

        expect(screen.getByText('No-goes')).toBeInTheDocument();
        expect(screen.getByText('No one wants Salad.')).toBeInTheDocument();

        expect(screen.getByText('Needs discussion')).toBeInTheDocument();
        expect(screen.getByText('There is a conflict regarding Tacos.')).toBeInTheDocument();
    });

    it('should correctly display harmonized results including matched Afraid to Ask ideas', () => {
        const decisionWithAfraidToAsk: Decision = {
            goTo: 'Everyone wants Pizza and a secret desire for a raise.', // Matched Afraid to Ask
            alsoGood: 'Many people are okay with Pasta.',
            considerable: 'Burgers are an option for some.',
            noGoes: 'No one wants Salad.',
            needsDiscussion: 'There is a conflict regarding Tacos.',
        };

        render(<ResultsDisplay decision={decisionWithAfraidToAsk} />);

        expect(screen.getByText('Go-to')).toBeInTheDocument();
        expect(screen.getByText('Everyone wants Pizza and a secret desire for a raise.')).toBeInTheDocument();

        expect(screen.getByText('Also good')).toBeInTheDocument();
        expect(screen.getByText('Many people are okay with Pasta.')).toBeInTheDocument();
    });
});
