import { mount } from '@vue/test-utils';
import { describe, expect, it } from 'vitest';
import KsDataContextHeader from '../KsDataContextHeader.vue';
const props = {
    title: 'Decision context',
    asOf: '2026-08-08T03:00:00Z',
    datasetId: 'dataset-20260808',
    dataHash: 'data-sha',
    modelVersion: 'model-v4',
    configVersion: 'config-v2',
    codeSha: 'code-sha',
    contractVersion: '4.0',
    projectionVersion: 'projection-v7',
    watermark: 'watermark-42',
    correlationId: 'corr-123'
};
function mountHeader(overrides = {}) {
    return mount(KsDataContextHeader, {
        props: { ...props, ...overrides },
        global: {
            stubs: {
                EvidenceVersionSet: { props: ['value', 'compact'], template: '<output :data-value="JSON.stringify(value)" />' }
            }
        }
    });
}
describe('KsDataContextHeader', () => {
    it('renders the required point-in-time and projection context', () => {
        const wrapper = mountHeader();
        expect(wrapper.text()).toContain('As-of 2026-08-08T03:00:00Z');
        expect(wrapper.text()).toContain('Projectionprojection-v7');
        expect(wrapper.text()).toContain('Watermarkwatermark-42');
        expect(wrapper.text()).toContain('Correlationcorr-123');
        expect(wrapper.get('output').attributes('data-value')).toContain('dataset-20260808');
        expect(wrapper.get('output').attributes('data-value')).toContain('code-sha');
    });
    it('exposes stale data both visually and to assistive technology', () => {
        const wrapper = mountHeader({ stale: true });
        expect(wrapper.get('header').attributes('data-stale')).toBe('true');
        expect(wrapper.get('[role="status"]').attributes('aria-label')).toBe('Data is stale');
        expect(wrapper.get('[role="status"]').text()).toBe('STALE');
    });
});
