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