4e9fa5b7e9
* #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
30 lines
658 B
TypeScript
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
|
|
}
|