Skip to content

Commit ea323f0

Browse files
committed
test(console): Home's tests stub the deployment notice like every other source the page reads
The administrator notice on the Console home reads its own state from the server, so the Home tests that render an admin reached a real socket and the network-escape guard failed them. Each one now stubs the notice module; its fetch, gate and copy stay pinned in DeploymentNotice.test.tsx. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cyhB3ePno23ywn1PQd
1 parent 53e09f5 commit ea323f0

12 files changed

Lines changed: 69 additions & 0 deletions

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.aiStudioDisabled.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ import { initRuntimeConfig, resetRuntimeConfigForTesting } from '../../../runtim
132132
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
133133
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
134134

135+
// The deployment notice reads its own state from the server for an administrator
136+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
137+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
138+
// like every other source this page reads.
139+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
140+
135141
import { HomePage } from '../HomePage';
136142

137143
/**

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.authoringCapabilityGate.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ vi.mock('../../../runtime-config', () => ({
144144
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
145145
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
146146

147+
// The deployment notice reads its own state from the server for an administrator
148+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
149+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
150+
// like every other source this page reads.
151+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
152+
147153
import { HomePage } from '../HomePage';
148154

149155
/* ── The `_drafts` double (objectui#7307) ─────────────────────────────────────

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.greetingAndApps-12601.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ vi.mock('../../../preview/usePublishAllDrafts', () => ({
150150
// Home marks an opened notification read through the bell's own write
151151
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
152152
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
153+
// The deployment notice reads its own state from the server for an administrator
154+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
155+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
156+
// like every other source this page reads.
157+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
153158

154159
import { HomePage } from '../HomePage';
155160

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.inboxLinksTarget.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ vi.mock('../../../runtime-config', () => ({
138138
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
139139
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
140140

141+
// The deployment notice reads its own state from the server for an administrator
142+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
143+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
144+
// like every other source this page reads.
145+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
146+
141147
import { HomePage } from '../HomePage';
142148

143149
/* ── The `_drafts` double (objectui#7307) ─────────────────────────────────────

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.launcherHiddenApps-26838.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ vi.mock('../../../preview/usePublishAllDrafts', () => ({
136136
// Home marks an opened notification read through the bell's own write
137137
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
138138
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
139+
// The deployment notice reads its own state from the server for an administrator
140+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
141+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
142+
// like every other source this page reads.
143+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
139144

140145
import { HomePage } from '../HomePage';
141146
import { LauncherAppsProvider } from '../../../hooks/useLauncherApps';

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.marketplaceDisabled.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ import { initRuntimeConfig, resetRuntimeConfigForTesting } from '../../../runtim
111111
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
112112
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
113113

114+
// The deployment notice reads its own state from the server for an administrator
115+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
116+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
117+
// like every other source this page reads.
118+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
119+
114120
import { HomePage } from '../HomePage';
115121

116122
/** A `GET /api/v1/runtime/config` answer, as the server sends it. */

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.myWork-12602.test.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ vi.mock('../../../views/studio-design/packages-io', async (importOriginal) => ({
148148
// Home marks an opened notification read through the bell's own write
149149
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
150150
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
151+
// The deployment notice reads its own state from the server for an administrator
152+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
153+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
154+
// like every other source this page reads.
155+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
151156

152157
import { HomePage } from '../HomePage';
153158

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.noAgentsBuildChip-26614.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ vi.mock('../../../preview/usePublishAllDrafts', () => ({
138138
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
139139
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
140140

141+
// The deployment notice reads its own state from the server for an administrator
142+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
143+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
144+
// like every other source this page reads.
145+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
146+
141147
import { HomePage } from '../HomePage';
142148
import { STUDIO_NEW_PACKAGE_PATH } from '../../../views/studio-design/studioNewPackage';
143149

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.pendingDraftsPackageName-13136.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ vi.mock('../../../preview/usePublishAllDrafts', () => ({
120120
// (`useInboxBell`); this harness serves no inbox feed, so the write is stubbed.
121121
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
122122

123+
// The deployment notice reads its own state from the server for an administrator
124+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
125+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
126+
// like every other source this page reads.
127+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
128+
123129
import { HomePage } from '../HomePage';
124130

125131
const DRAFTS_ROUTE = '/api/v1/meta/_drafts';

‎ui/packages/app-shell/src/console/home/__tests__/HomePage.phoneTapTargets-29147.test.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ vi.mock('../../../preview/usePublishAllDrafts', () => ({
133133
vi.mock('../../../hooks/useInboxBell', () => ({ useInboxBell: () => ({ markRead: vi.fn() }) }));
134134
vi.mock('../../../layout/ActivityObjectLabel', () => ({ ActivityObjectLabel: () => null }));
135135

136+
// The deployment notice reads its own state from the server for an administrator
137+
// (objectstack#30120); its fetch, its gate and its copy are pinned in
138+
// `deployment-notice/__tests__/DeploymentNotice.test.tsx`, so it is stubbed here
139+
// like every other source this page reads.
140+
vi.mock('../../deployment-notice/DeploymentNotice', () => ({ DeploymentNotice: () => null }));
141+
136142
import { HomePage } from '../HomePage';
137143

138144
/** Enough apps that the strip folds the rest behind "More". */

0 commit comments

Comments
 (0)