Skip to content

Commit c910024

Browse files
committed
test(app-shell): count the new entry's draft reads as at least one
The sheet's security-posture lint also reads each object draft once its rule module loads, so the exact count is timing-dependent (red on CI Test UI 8/16). The pinned behaviour, no published read for a NEW entry, is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011fs46jjQVe98Y5YTfDTixa
1 parent e32db46 commit c910024

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.newEntryNoPublishedRead-25894.test.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ afterEach(() => {
6969
/** The published item reads sent for `name` (no `state=draft`). */
7070
const publishedReads = (name: string) =>
7171
requests.filter((u) => u.includes(`/meta/object/${name}`) && !u.includes('state=draft'));
72+
/**
73+
* The draft reads sent for `name`. Counted as "at least one", never exactly:
74+
* the sheet's security-posture lint reads each object draft too, once its
75+
* rule module has loaded, so the total depends on that load's timing.
76+
*/
7277
const draftReads = (name: string) =>
7378
requests.filter((u) => u.includes(`/meta/object/${name}`) && u.includes('state=draft'));
7479

@@ -83,7 +88,7 @@ describe('objectstack-ai/objectstack#25894 — a NEW draft is not asked for its
8388
await waitFor(() => expect(screen.getAllByTestId('draft-entry-detail')).toHaveLength(DRAFT_ROWS.length));
8489
await waitFor(() => expect(publishedReads('st_queue')).toHaveLength(1));
8590

86-
expect(draftReads('st_ticket'), 'the drill-in never ran: the harness is dead').toHaveLength(1);
91+
expect(draftReads('st_ticket').length, 'the drill-in never ran: the harness is dead').toBeGreaterThan(0);
8792
expect(publishedReads('st_ticket')).toEqual([]);
8893
expect(publishedReads('st_queue')[0]).toContain(`package=${PKG}`);
8994
expect(screen.getByText('New')).toBeInTheDocument();
@@ -105,7 +110,7 @@ describe('objectstack-ai/objectstack#25894 — a NEW draft is not asked for its
105110

106111
answer();
107112
await waitFor(() => expect(publishedReads('st_queue')).toHaveLength(1));
108-
await waitFor(() => expect(draftReads('st_ticket')).toHaveLength(1));
113+
await waitFor(() => expect(draftReads('st_ticket').length).toBeGreaterThan(0));
109114
expect(publishedReads('st_ticket')).toEqual([]);
110115
});
111116

0 commit comments

Comments
 (0)