Move to eslint
[oweals/peertube.git] / shared / extra-utils / server / contact-form.ts
1 import * as request from 'supertest'
2 import { ContactForm } from '../../models/server'
3
4 function sendContactForm (options: {
5   url: string
6   fromEmail: string
7   fromName: string
8   subject: string
9   body: string
10   expectedStatus?: number
11 }) {
12   const path = '/api/v1/server/contact'
13
14   const body: ContactForm = {
15     fromEmail: options.fromEmail,
16     fromName: options.fromName,
17     subject: options.subject,
18     body: options.body
19   }
20   return request(options.url)
21     .post(path)
22     .send(body)
23     .expect(options.expectedStatus || 204)
24 }
25
26 // ---------------------------------------------------------------------------
27
28 export {
29   sendContactForm
30 }