Skip to content

Commit 225df15

Browse files
committed
test(rsc-mf): assert proxy map entry count aligns with ids
1 parent 6256add commit 225df15

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

tests/integration/rsc-mf/host/src/server-component-root/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ const App = () => {
9999
const remoteActionIdMapKey = JSON.stringify(
100100
remoteActionIdToHostProxyActionEntries,
101101
);
102+
const remoteActionIdMapEntryCount =
103+
remoteActionIdToHostProxyActionEntries.length;
102104

103105
const remoteServerOnlyInfo = getServerOnlyInfo();
104106
const remoteServerOnlyDefaultInfo = getServerOnlyDefaultInfo();
@@ -128,6 +130,9 @@ const App = () => {
128130
<p className="host-proxy-action-id-count">
129131
{uniqueHostProxyActionIdsCount}
130132
</p>
133+
<p className="host-proxy-map-entry-count">
134+
{remoteActionIdMapEntryCount}
135+
</p>
131136
<p className="host-proxy-action-ids">
132137
{uniqueHostProxyActionIds.join(',')}
133138
</p>

tests/integration/rsc-mf/tests/index.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ async function renderRemoteRscIntoHost({ hostPort, page }: TestContext) {
6565
expect(html).toContain('host-remote-bundled-server-only');
6666
expect(html).toContain('host-remote-bundled-meta-kind');
6767
expect(html).toContain('host-proxy-action-id-count');
68+
expect(html).toContain('host-proxy-map-entry-count');
6869
expect(html).toContain('host-proxy-action-ids');
6970
expect(html).toContain('host-direct-proxy-action-ids');
7071
expect(html).toContain('host-bundled-proxy-action-ids');
@@ -117,13 +118,19 @@ async function renderRemoteRscIntoHost({ hostPort, page }: TestContext) {
117118
el => el.textContent?.trim(),
118119
);
119120
expect(hostProxyActionIdCount).toBe('8');
121+
const hostProxyMapEntryCount = await page.$eval(
122+
'.host-proxy-map-entry-count',
123+
el => el.textContent?.trim(),
124+
);
125+
expect(hostProxyMapEntryCount).toBe('8');
120126
const hostProxyActionIds = await page.$eval('.host-proxy-action-ids', el =>
121127
el.textContent?.trim(),
122128
);
123129
const hostProxyActionIdList = hostProxyActionIds
124130
?.split(',')
125131
.filter(Boolean) as string[];
126132
expect(hostProxyActionIdList.length).toBe(8);
133+
expect(hostProxyActionIdList.length).toBe(Number(hostProxyMapEntryCount));
127134
expect(new Set(hostProxyActionIdList).size).toBe(8);
128135
expect(hostProxyActionIdList.every(id => /^[a-f0-9]{64,}$/i.test(id))).toBe(
129136
true,

0 commit comments

Comments
 (0)