astro/packages/astro/test/astro-jsx.test.js
2021-12-22 16:11:05 -05:00

41 lines
1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
let cwd = './fixtures/astro-jsx/';
let orders = [
['preact', 'react', 'solid'],
['preact', 'solid', 'react'],
['react', 'preact', 'solid'],
['react', 'solid', 'preact'],
['solid', 'react', 'preact'],
['solid', 'preact', 'react'],
];
let fixtures = {};
before(async () => {
await Promise.all(
orders.map((renderers, n) =>
loadFixture({
projectRoot: cwd,
renderers: renderers.map((name) => `@astrojs/renderer-${name}`),
dist: new URL(`${cwd}dist-${n}/`, import.meta.url),
}).then((fixture) => {
fixtures[renderers.toString()] = fixture;
return fixture.build();
})
)
);
});
it('Renderer order', () => {
it('JSX renderers can be defined in any order', async () => {
if (!Object.values(fixtures).length) {
throw new Error(`JSX renderers didnt build properly`);
}
for (const [name, fixture] of Object.entries(fixtures)) {
const html = await fixture.readFile('/index.html');
expect(html, name).to.be.ok;
}
});
});