Skip to content

Commit 4c38380

Browse files
committed
test(app-shell): the form-view type pin's client serves the draft-overlaid read
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6CXDf4Yt5PtKZFbtLVD
1 parent fe49404 commit 4c38380

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎ui/packages/app-shell/src/views/metadata-admin/inspectors/ViewVariantInspector.formViewType-30046.test.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ import * as React from 'react';
1919
import { describe, it, expect, vi, afterEach } from 'vitest';
2020
import { render, screen, cleanup, fireEvent, waitFor } from '@testing-library/react';
2121

22-
const state = vi.hoisted(() => ({
23-
metadataClient: {
22+
const state = vi.hoisted(() => {
23+
const metadataClient: Record<string, unknown> = {
2424
get: vi.fn(async () => undefined),
2525
list: vi.fn(async (type: string) => (type === 'object' ? [{ name: 'crm_lead', label: 'Lead' }] : ([] as unknown[]))),
26-
},
27-
}));
26+
};
27+
// The bound object's field read goes through the draft-overlaid door.
28+
metadataClient.withPreviewDrafts = () => metadataClient;
29+
return { metadataClient };
30+
});
2831
vi.mock('../useMetadata', async (importOriginal) => {
2932
const mod = await importOriginal<typeof import('../useMetadata')>();
3033
return { ...mod, useMetadataClient: () => state.metadataClient };

0 commit comments

Comments
 (0)