summaryrefslogtreecommitdiff
path: root/examples/container-with-vitest/test/ReactWrapper.test.ts
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2024-05-22 12:11:26 +0100
committerGravatar GitHub <noreply@github.com> 2024-05-22 12:11:26 +0100
commit12a1bccc818af292cdd2a8ed0f3e3c042b9819b4 (patch)
treec031a014c1e68992aaf2419cb2f4355041b596cc /examples/container-with-vitest/test/ReactWrapper.test.ts
parenta6916e4402bf5b7d74bab784a54eba63fd1d1179 (diff)
downloadastro-12a1bccc818af292cdd2a8ed0f3e3c042b9819b4.tar.gz
astro-12a1bccc818af292cdd2a8ed0f3e3c042b9819b4.tar.zst
astro-12a1bccc818af292cdd2a8ed0f3e3c042b9819b4.zip
feat: container APIs (#11051)
* feat: container APIs * chore: handle runtime mode * chore: render slots * more prototyping * Adding a changeset * fix some weirdness around types * feat: allow to inject the manifest * feat: accept a manifest * more APIs * add `route` to the options * chore * fix component instance * chore: document stuff * remove commented code * chore: add test for renderers and fixed its types * fix: update name of the example * fix regression inside tests * use `experimental_` * remove errors * need to understand the types here * remove some options that I don't deem necessary for this phase * remove superfluous comments * chore: remove useless `@ts-ignore` directive * chore: address feedback * fix regression and remove astro config * chore: fix regression * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * ooops * restore changes --------- Co-authored-by: Matthew Phillips <matthew@skypack.dev> Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'examples/container-with-vitest/test/ReactWrapper.test.ts')
-rw-r--r--examples/container-with-vitest/test/ReactWrapper.test.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/container-with-vitest/test/ReactWrapper.test.ts b/examples/container-with-vitest/test/ReactWrapper.test.ts
new file mode 100644
index 000000000..2f21d8596
--- /dev/null
+++ b/examples/container-with-vitest/test/ReactWrapper.test.ts
@@ -0,0 +1,19 @@
+import { experimental_AstroContainer as AstroContainer } from 'astro/container';
+import { expect, test } from 'vitest';
+import ReactWrapper from '../src/components/ReactWrapper.astro';
+
+test('ReactWrapper with react renderer', async () => {
+ const container = await AstroContainer.create({
+ renderers: [
+ {
+ name: '@astrojs/react',
+ clientEntrypoint: "@astrojs/react/client.js",
+ serverEntrypoint: "@astrojs/react/server.js",
+ }
+ ]
+ });
+ const result = await container.renderToString(ReactWrapper);
+
+ expect(result).toContain('Counter');
+ expect(result).toContain('Count: <!-- -->5');
+});