From 7fefb35f25ae4e2a120202fb2403d79aa1d89575 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 28 Oct 2026 04:43:54 +0100 Subject: [PATCH] test: send organisation signatures and disclaimers whose HTML and text versions differ --- integration/tests/19-org-signatures.spec.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/integration/tests/19-org-signatures.spec.ts b/integration/tests/19-org-signatures.spec.ts index 23ae5ac1e..5ed017f60 100644 --- a/integration/tests/19-org-signatures.spec.ts +++ b/integration/tests/19-org-signatures.spec.ts @@ -27,6 +27,11 @@ const STAMP = Date.now().toString(36); const SIGNATURE_MARK = `Org signature ${STAMP}`; const SIGNATURE_HTML = `

{name}
Phone: {phone}
Mobile: {mobile}

${SIGNATURE_MARK}

`; const DISCLAIMER = `Confidential ${STAMP}: meant for the addressee only.`; +// The plain-text templates differ from the HTML ones, so a check that +// compares one against the other would add them twice. +const SIGNATURE_TEXT = `{name} | Phone {phone} | ${SIGNATURE_MARK}`; +const DISCLAIMER_HTML = `

${DISCLAIMER} Imprint

`; +const DISCLAIMER_TEXT = `${DISCLAIMER} Imprint: https://example.org/imprint`; const PHONE = '+49 30 5550100'; let original: Record; @@ -173,7 +178,9 @@ test('the admin sets a locked signature and a disclaimer for example.org', async await expect(page.getByTestId('org-signature-preview')).toContainText(SIGNATURE_MARK, { timeout: 2000 }); }).toPass({ timeout: 20000 }); await expect(page.getByTestId('org-signature-fields').locator('[data-used]')).toHaveCount(2); - await page.getByTestId('org-disclaimer-text').fill(DISCLAIMER); + await page.getByTestId('org-signature-text').fill(SIGNATURE_TEXT); + await page.getByTestId('org-disclaimer-html').fill(DISCLAIMER_HTML); + await page.getByTestId('org-disclaimer-text').fill(DISCLAIMER_TEXT); await page.getByLabel('Lock').check(); await page.getByRole('button', { name: 'Save', exact: true }).click(); await expect(page.getByText('Saved.')).toBeVisible(); @@ -184,8 +191,8 @@ test('the admin sets a locked signature and a disclaimer for example.org', async const policy = await getPolicy(admin); const scope = (policy.scopes as Array<{ id: string; policy: Record }>).find((s) => s.id === 'example-org')!; - expect(scope.policy.organisation.signature).toEqual({ html: SIGNATURE_HTML, fields: ['phone', 'mobile'] }); - expect(scope.policy.organisation.disclaimer).toEqual({ text: DISCLAIMER }); + expect(scope.policy.organisation.signature).toEqual({ html: SIGNATURE_HTML, text: SIGNATURE_TEXT, fields: ['phone', 'mobile'] }); + expect(scope.policy.organisation.disclaimer).toEqual({ html: DISCLAIMER_HTML, text: DISCLAIMER_TEXT }); expect(scope.policy.restrictions.signature).toEqual({ locked: true }); // Everyone has no signature. expect((policy.organisation as Record).signature.html).toBe(''); @@ -217,7 +224,8 @@ test("org-alice's new mail carries the signature and the disclaimer once", async expect(countOf(received.html, DISCLAIMER)).toBe(1); expect(countOf(received.text, DISCLAIMER)).toBe(1); // Below everything. - expect(received.text.trimEnd().endsWith(DISCLAIMER)).toBe(true); + expect(received.text.trimEnd().endsWith(DISCLAIMER_TEXT)).toBe(true); + expect(received.html).toContain(`${DISCLAIMER}`); await alice.context().close(); });