2019-01-09 15:14:29 +01:00
|
|
|
import * as request from 'supertest'
|
|
|
|
import { ContactForm } from '../../models/server'
|
2020-12-07 14:32:36 +01:00
|
|
|
import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes'
|
2019-01-09 15:14:29 +01:00
|
|
|
|
|
|
|
function sendContactForm (options: {
|
2020-01-31 16:56:52 +01:00
|
|
|
url: string
|
|
|
|
fromEmail: string
|
|
|
|
fromName: string
|
|
|
|
subject: string
|
|
|
|
body: string
|
2019-01-09 15:14:29 +01:00
|
|
|
expectedStatus?: number
|
|
|
|
}) {
|
|
|
|
const path = '/api/v1/server/contact'
|
|
|
|
|
|
|
|
const body: ContactForm = {
|
|
|
|
fromEmail: options.fromEmail,
|
|
|
|
fromName: options.fromName,
|
2019-06-21 08:49:35 +02:00
|
|
|
subject: options.subject,
|
2019-01-09 15:14:29 +01:00
|
|
|
body: options.body
|
|
|
|
}
|
|
|
|
return request(options.url)
|
|
|
|
.post(path)
|
|
|
|
.send(body)
|
2020-12-07 14:32:36 +01:00
|
|
|
.expect(options.expectedStatus || HttpStatusCode.NO_CONTENT_204)
|
2019-01-09 15:14:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
sendContactForm
|
|
|
|
}
|