import { canSubmitMessage } from '../can_submit_message' const base = { isPending: false, conversationDisabled: false, pendingUploads: false, hasFlaggedAttachments: false, hasText: false, hasSendableAttachments: false, } describe('canSubmitMessage', () => { it.each([ ['empty form', base, false], ['has text', { ...base, hasText: true }, true], ['has attachments', { ...base, hasSendableAttachments: true }, true], ['pending request blocks submit', { ...base, hasText: true, isPending: true }, false], [ 'conversation disabled blocks submit', { ...base, hasText: true, conversationDisabled: true }, false, ], ['pending uploads block submit', { ...base, hasText: true, pendingUploads: true }, false], [ 'flagged attachments block submit', { ...base, hasText: true, hasFlaggedAttachments: true }, false, ], ])('%s', (_label, args, expected) => { expect(canSubmitMessage(args)).toBe(expected) }) })