2024-06-05 10:41:15 +00:00
|
|
|
import { loadRenderers } from 'astro:container';
|
|
|
|
import { getContainerRenderer } from '@astrojs/react';
|
2024-05-22 12:11:26 +01:00
|
|
|
import { experimental_AstroContainer as AstroContainer } from 'astro/container';
|
|
|
|
import { expect, test } from 'vitest';
|
|
|
|
import ReactWrapper from '../src/components/ReactWrapper.astro';
|
2024-06-05 11:39:42 +01:00
|
|
|
|
|
|
|
const renderers = await loadRenderers([getContainerRenderer()]);
|
|
|
|
const container = await AstroContainer.create({
|
2024-06-13 13:05:54 +00:00
|
|
|
renderers,
|
2024-06-05 11:39:42 +01:00
|
|
|
});
|
2024-05-22 12:11:26 +01:00
|
|
|
|
|
|
|
test('ReactWrapper with react renderer', async () => {
|
|
|
|
const result = await container.renderToString(ReactWrapper);
|
|
|
|
|
|
|
|
expect(result).toContain('Counter');
|
|
|
|
expect(result).toContain('Count: <!-- -->5');
|
|
|
|
});
|