2019-01-09 09:14:29 -05:00
|
|
|
import * as request from 'supertest'
|
|
|
|
import { ContactForm } from '../../models/server'
|
|
|
|
|
|
|
|
function sendContactForm (options: {
|
|
|
|
url: string,
|
|
|
|
fromEmail: string,
|
|
|
|
fromName: string,
|
2019-06-21 02:49:35 -04:00
|
|
|
subject: string,
|
2019-01-09 09:14:29 -05:00
|
|
|
body: string,
|
|
|
|
expectedStatus?: number
|
|
|
|
}) {
|
|
|
|
const path = '/api/v1/server/contact'
|
|
|
|
|
|
|
|
const body: ContactForm = {
|
|
|
|
fromEmail: options.fromEmail,
|
|
|
|
fromName: options.fromName,
|
2019-06-21 02:49:35 -04:00
|
|
|
subject: options.subject,
|
2019-01-09 09:14:29 -05:00
|
|
|
body: options.body
|
|
|
|
}
|
|
|
|
return request(options.url)
|
|
|
|
.post(path)
|
|
|
|
.send(body)
|
|
|
|
.expect(options.expectedStatus || 204)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export {
|
|
|
|
sendContactForm
|
|
|
|
}
|