import { afterEach, describe, it, expect } from 'vitest';
import { cleanup, render } from 'vitest-browser-svelte';
import OcrHealthBar from './OcrHealthBar.svelte';

afterEach(cleanup);

describe('OcrHealthBar', () => {
	it('shows online status when OCR service is available', async () => {
		render(OcrHealthBar, { ocrServiceAvailable: true });
		const dot = document.querySelector('[role="img"]');
		expect(dot?.className).toContain('bg-green-500');
	});

	it('shows offline status when OCR service is unavailable', async () => {
		render(OcrHealthBar, { ocrServiceAvailable: false });
		const dot = document.querySelector('[role="img"]');
		expect(dot?.className).toContain('bg-red-500');
	});
});
