mirror of https://github.com/Chocobozzz/PeerTube
29 lines
609 B
TypeScript
29 lines
609 B
TypeScript
|
import * as request from 'supertest'
|
||
|
import { ContactForm } from '../../models/server'
|
||
|
|
||
|
function sendContactForm (options: {
|
||
|
url: string,
|
||
|
fromEmail: string,
|
||
|
fromName: string,
|
||
|
body: string,
|
||
|
expectedStatus?: number
|
||
|
}) {
|
||
|
const path = '/api/v1/server/contact'
|
||
|
|
||
|
const body: ContactForm = {
|
||
|
fromEmail: options.fromEmail,
|
||
|
fromName: options.fromName,
|
||
|
body: options.body
|
||
|
}
|
||
|
return request(options.url)
|
||
|
.post(path)
|
||
|
.send(body)
|
||
|
.expect(options.expectedStatus || 204)
|
||
|
}
|
||
|
|
||
|
// ---------------------------------------------------------------------------
|
||
|
|
||
|
export {
|
||
|
sendContactForm
|
||
|
}
|