// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ import { i18n } from '#shared/i18n.ts' import { useCheckBodyAttachmentReference } from '../useCheckBodyAttachmentReference.ts' describe('useCheckBodyAttachmentReference', () => { it('check for missing body attachment reference', () => { const { missingBodyAttachmentReference } = useCheckBodyAttachmentReference() expect(missingBodyAttachmentReference('I attached a file.')).toBeTruthy() }) it('check for existing attachment and body reference', () => { const { missingBodyAttachmentReference } = useCheckBodyAttachmentReference() expect( missingBodyAttachmentReference('I attached a file.', [ { id: '123', name: 'filename.png' }, ]), ).toBeFalsy() }) it('not attachment reference in body', () => { const { missingBodyAttachmentReference } = useCheckBodyAttachmentReference() expect( missingBodyAttachmentReference('I worked on the problem.'), ).toBeFalsy() }) it('ignore attachment match words in quoted body parts', () => { const { missingBodyAttachmentReference } = useCheckBodyAttachmentReference() expect( missingBodyAttachmentReference( '
Yes I did already a first look.
', ), ).toBeFalsy() }) it('ignore attachment match words in signatures', () => { const { missingBodyAttachmentReference } = useCheckBodyAttachmentReference() expect( missingBodyAttachmentReference( 'I attached a file did you saw id?
Yes I did already a first look.
I attached a file did you saw id?
Siehe Screenshot der Telefonanlage
', ), ).toBeFalsy() }) })