1
0
Fork 0
peertube/shared/extra-utils/server/contact-form.ts
Nassim Bounouas 4e9fa5b7e9 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
2019-06-21 08:49:35 +02:00

30 lines
658 B
TypeScript

import * as request from 'supertest'
import { ContactForm } from '../../models/server'
function sendContactForm (options: {
url: string,
fromEmail: string,
fromName: string,
subject: string,
body: string,
expectedStatus?: number
}) {
const path = '/api/v1/server/contact'
const body: ContactForm = {
fromEmail: options.fromEmail,
fromName: options.fromName,
subject: options.subject,
body: options.body
}
return request(options.url)
.post(path)
.send(body)
.expect(options.expectedStatus || 204)
}
// ---------------------------------------------------------------------------
export {
sendContactForm
}