Skip to content

Commit 28dcf34

Browse files
committed
test(compiler): add ReplexicaCompiler smoke tests
1 parent 6c2d99a commit 28dcf34

2 files changed

Lines changed: 577 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2+
3+
exports[`Compiles attribute values > compiles attribute values 1`] = `
4+
"import { ReplexicaServerProxy as _ReplexicaServerProxy } from "@replexica/react/server";
5+
import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
6+
<div>
7+
<_ReplexicaServerProxy title="Hello!" __ReplexicaComponent="span" __ReplexicaAttributes={{
8+
"title": {
9+
"fileId": "fileId_0",
10+
"scopeId": "scopeId_1",
11+
"chunkId": "chunkId_1"
12+
}
13+
}}><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></_ReplexicaServerProxy>
14+
</div>;"
15+
`;
16+
17+
exports[`Compiles content > jsx assigned to jsx attribute 1`] = `
18+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
19+
<div>
20+
<div data-test={<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_1" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>}><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></div>
21+
</div>;"
22+
`;
23+
24+
exports[`Compiles content > multiple basic spans 1`] = `
25+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
26+
<div>
27+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
28+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_1" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
29+
</div>;"
30+
`;
31+
32+
exports[`Compiles content > nested basic spans 1`] = `
33+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
34+
<div>
35+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
36+
<div>
37+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_1" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
38+
</div>
39+
</div>;"
40+
`;
41+
42+
exports[`Compiles content > nested elements mixed with text 1`] = `
43+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
44+
<div>
45+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
46+
<div><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_1" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /><br /><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_2" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /><b><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_3" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></b><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_4" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /><a href="#"><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_5" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></a><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_1" chunkId="chunkId_6" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></div>
47+
</div>;"
48+
`;
49+
50+
exports[`Compiles content > one basic span 1`] = `
51+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
52+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>;"
53+
`;
54+
55+
exports[`Skips nodes marked with \`data-replexica-skip\` > skips a single node 1`] = `
56+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
57+
<div>
58+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
59+
<div data-replexica-skip>
60+
Goodbye, world!
61+
</div>
62+
</div>;"
63+
`;
64+
65+
exports[`Skips nodes marked with \`data-replexica-skip\` > skips entire subtree 1`] = `
66+
"import { ReplexicaServerChunk as _ReplexicaServerChunk } from "@replexica/react/server";
67+
<div>
68+
<span><_ReplexicaServerChunk fileId="fileId_0" scopeId="scopeId_0" chunkId="chunkId_0" importer={locale => import(\`./../../i18n/\${locale}.json\`).then(m => m.default)} /></span>
69+
<div data-replexica-skip>
70+
Goodbye, world!
71+
<br />
72+
You can say <b>hello</b> again by clicking <a href="#">here</a>.
73+
</div>
74+
</div>;"
75+
`;

0 commit comments

Comments
 (0)