Skip to content

Commit 2d7fd8f

Browse files
committed
test(app-shell): the read-only posture double carries headers at its stub, clear of a sibling PR's lines
Claude-Session: https://claude.ai/code/session_01QSeKYmRepQK9DkZeU7F53D Co-authored-by: Claude <noreply@anthropic.com>
1 parent 25b9ce2 commit 2d7fd8f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,20 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul
6060
import { StudioDesignSurface } from './StudioDesignSurface';
6161
import { t } from '../metadata-admin/i18n';
6262

63-
const answer = (body: unknown) => ({ headers: new Headers(), ok: true, status: 200, json: async () => body });
63+
const answer = (body: unknown) => ({ ok: true, status: 200, json: async () => body });
6464
const PILLARS = ['data', 'automations', 'interfaces', 'access'] as const;
6565
const READ_ONLY = t('engine.studio.pkg.readonly', 'en');
6666

6767
function servePackage(writable: boolean) {
6868
vi.stubGlobal(
6969
'fetch',
70-
vi.fn(async (input: unknown) =>
71-
String(input) === '/api/v1/packages'
70+
// The headers a real Response carries: the package list reads them through the authenticated fetch.
71+
vi.fn(async (input: unknown) => ({
72+
headers: new Headers(),
73+
...(String(input) === '/api/v1/packages'
7274
? answer({ success: true, data: { packages: [{ manifest: { id: PACKAGE_ID, name: 'Field Ops' }, writable }] } })
73-
: answer([]),
74-
),
75+
: answer([])),
76+
})),
7577
);
7678
}
7779

0 commit comments

Comments
 (0)