import assert from 'node:assert/strict';
import { describe, it, before } from 'node:test';
import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js';

describe('Multiple renderers', () => {
	/** @type {import('./test-utils').Fixture} */
	let fixture;

	before(async () => {
		fixture = await loadFixture({
			root: './fixtures/multiple-renderers/',
		});
		await fixture.build();
	});

	it('when the first throws but the second does not, use the second renderer', async () => {
		const html = await fixture.readFile('/index.html');
		const $ = cheerio.load(html);
		assert.equal($('#component').length, 1);
	});
});
