test(ui): drop tautological #2903 enabled-gate helper
The helper reimplemented `if (!enabled) return []` locally, so those cases never exercised the real hook. Keep the snapshot-builder and source-contract coverage instead. Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
committed by
Cursor Agent
co-authored by
Serhii Dziupin
parent
0a07bc7e03
commit
de0455e10e
-35
@@ -64,21 +64,6 @@ const buildFourteenMessageSnapshot = () => {
|
||||
return materializeSessionSnapshots({ message: {}, part: {} }, SESSION_ID, records);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cold-start `useSessionMessageRecords` when `enabled === false` and no prior
|
||||
* snapshot exists for the session: getSnapshot returns EMPTY records even
|
||||
* though the store already holds a renderable transcript.
|
||||
*/
|
||||
const readRecordsThroughEnabledGate = (
|
||||
storeMessages: ReturnType<typeof buildSessionMessageRecordsSnapshot>['list'],
|
||||
enabled: boolean,
|
||||
) => {
|
||||
if (enabled === false) {
|
||||
return [];
|
||||
}
|
||||
return storeMessages;
|
||||
};
|
||||
|
||||
describe('issue #2903 busy embedded subagent status-line-only', () => {
|
||||
test('materialized 14-message subagent is renderable and snapshottable', () => {
|
||||
const materialized = buildFourteenMessageSnapshot();
|
||||
@@ -99,26 +84,6 @@ describe('issue #2903 busy embedded subagent status-line-only', () => {
|
||||
);
|
||||
});
|
||||
|
||||
test('inactive enabled:false hides a fully-renderable session (0 records)', () => {
|
||||
const materialized = buildFourteenMessageSnapshot();
|
||||
const records = buildSessionMessageRecordsSnapshot(
|
||||
{ ...INITIAL_STATE, message: materialized.message, part: materialized.part },
|
||||
SESSION_ID,
|
||||
);
|
||||
expect(getSessionMaterializationStatus(materialized, SESSION_ID).renderable).toBe(true);
|
||||
expect(records.list).toHaveLength(14);
|
||||
expect(readRecordsThroughEnabledGate(records.list, false)).toHaveLength(0);
|
||||
});
|
||||
|
||||
test('enabled:true reveals all 14 materialized records', () => {
|
||||
const materialized = buildFourteenMessageSnapshot();
|
||||
const records = buildSessionMessageRecordsSnapshot(
|
||||
{ ...INITIAL_STATE, message: materialized.message, part: materialized.part },
|
||||
SESSION_ID,
|
||||
);
|
||||
expect(readRecordsThroughEnabledGate(records.list, true)).toHaveLength(14);
|
||||
});
|
||||
|
||||
test('sync gate still returns empty on cold disabled reads', () => {
|
||||
const hookStart = syncContextSource.indexOf('export function useSessionMessageRecords(');
|
||||
const hookBody = syncContextSource.slice(hookStart, hookStart + 1800);
|
||||
|
||||
Reference in New Issue
Block a user