From 4e9fa5b7e9ca6030a5fe2e9b0520bf8fa18e5877 Mon Sep 17 00:00:00 2001 From: Nassim Bounouas Date: Fri, 21 Jun 2019 08:49:35 +0200 Subject: Feature/subject in contact form (#1926) * #1915 Add a subject to contact form and add it to email sent * #1915 Add subject to contact form tests * #1915 Contact form test corrected && tslint correction --- server/tests/api/check-params/contact-form.ts | 1 + server/tests/api/server/contact-form.ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/contact-form.ts b/server/tests/api/check-params/contact-form.ts index dbdd3a8a6..b3051945e 100644 --- a/server/tests/api/check-params/contact-form.ts +++ b/server/tests/api/check-params/contact-form.ts @@ -26,6 +26,7 @@ describe('Test contact form API validators', function () { const defaultBody = { fromName: 'super name', fromEmail: 'toto@example.com', + subject: 'my subject', body: 'Hello, how are you?' } let emailPort: number diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts index 87e55060c..e4e895acb 100644 --- a/server/tests/api/server/contact-form.ts +++ b/server/tests/api/server/contact-form.ts @@ -43,6 +43,7 @@ describe('Test contact form', function () { url: server.url, fromEmail: 'toto@example.com', body: 'my super message', + subject: 'my subject', fromName: 'Super toto' }) @@ -55,7 +56,7 @@ describe('Test contact form', function () { expect(email['from'][0]['address']).equal('test-admin@localhost') expect(email['from'][0]['name']).equal('toto@example.com') expect(email['to'][0]['address']).equal('admin' + server.internalServerNumber + '@example.com') - expect(email['subject']).contains('Contact form') + expect(email['subject']).contains('my subject') expect(email['text']).contains('my super message') }) @@ -64,6 +65,7 @@ describe('Test contact form', function () { url: server.url, fromEmail: 'toto@example.com', body: 'my super message', + subject: 'my subject', fromName: 'Super toto' }) @@ -72,6 +74,7 @@ describe('Test contact form', function () { fromEmail: 'toto@example.com', body: 'my super message', fromName: 'Super toto', + subject: 'my subject', expectedStatus: 403 }) }) @@ -82,8 +85,9 @@ describe('Test contact form', function () { await sendContactForm({ url: server.url, fromEmail: 'toto@example.com', - body: 'my super message', - fromName: 'Super toto' + fromName: 'Super toto', + subject: 'my subject', + body: 'my super message' }) }) -- cgit v1.2.3