import test from 'node:test' import assert from 'node:assert/strict' import { draftReviewCount, draftNeedsRichNoticeReview } from '../src/core/assistant-display.ts' test('broadcast review counts recipients so the existing twenty item confirmation guard applies', () => { assert.equal(draftReviewCount({ action: 'notification.send', rows: [{ _notificationPreview: { recipientCount: 401, recipients: [{ id: 1 }] } }] }), 401) assert.equal(draftReviewCount({ action: 'notification.send', rows: [{ _notificationPreview: { recipients: Array.from({ length: 21 }, (_, id) => ({ id })) } }] }), 21) assert.equal(draftReviewCount({ action: 'notification.send', rows: [{ _notificationPreview: { recipientCount: 3 } }, { _notificationPreview: { recipientCount: 2 } }] }), 5) assert.equal(draftReviewCount({ action: 'purchase.referencePrice', rows: [{ _referencePricePreview: [1, 2] }] }), 2) }) test('image announcements require full graphical review on web, without blocking ordinary inbox drafts', () => { assert.equal(draftNeedsRichNoticeReview({ action: 'notice.create', rows: [{ noticeContent: '

说明

' }] }), true) assert.equal(draftNeedsRichNoticeReview({ action: 'notice.update', rows: [{ noticeContent: '' }] }), true) assert.equal(draftNeedsRichNoticeReview({ action: 'notification.send', rows: [{ content: '普通通知' }] }), false) })