import { describe, it, expect } from 'vitest';
import de from '../../messages/de.json';
import en from '../../messages/en.json';
import es from '../../messages/es.json';

describe('message key parity', () => {
	it('de, en, and es have identical key sets', () => {
		const deKeys = Object.keys(de).sort();
		const enKeys = Object.keys(en).sort();
		const esKeys = Object.keys(es).sort();
		expect(enKeys).toEqual(deKeys);
		expect(esKeys).toEqual(deKeys);
	});

	it('viewer navigation keys are present in all locales', () => {
		const requiredViewerKeys = [
			'viewer_previous_page',
			'viewer_next_page',
			'viewer_zoom_out',
			'viewer_zoom_in'
		];
		for (const key of requiredViewerKeys) {
			expect(de, `missing key in de: ${key}`).toHaveProperty(key);
			expect(en, `missing key in en: ${key}`).toHaveProperty(key);
			expect(es, `missing key in es: ${key}`).toHaveProperty(key);
		}
	});

	it('transcribe mark-for-training key is present in all locales', () => {
		expect(de).toHaveProperty('transcribe_mark_for_training');
		expect(en).toHaveProperty('transcribe_mark_for_training');
		expect(es).toHaveProperty('transcribe_mark_for_training');
	});

	it('layout menu open/close keys are present in all locales', () => {
		expect(de).toHaveProperty('layout_menu_open');
		expect(de).toHaveProperty('layout_menu_close');
		expect(en).toHaveProperty('layout_menu_open');
		expect(en).toHaveProperty('layout_menu_close');
		expect(es).toHaveProperty('layout_menu_open');
		expect(es).toHaveProperty('layout_menu_close');
	});
});
