]>
Commit | Line | Data |
---|---|---|
a4101923 C |
1 | import * as request from 'supertest' |
2 | import { ContactForm } from '../../models/server' | |
3 | ||
4 | function sendContactForm (options: { | |
a1587156 C |
5 | url: string |
6 | fromEmail: string | |
7 | fromName: string | |
8 | subject: string | |
9 | body: string | |
a4101923 C |
10 | expectedStatus?: number |
11 | }) { | |
12 | const path = '/api/v1/server/contact' | |
13 | ||
14 | const body: ContactForm = { | |
15 | fromEmail: options.fromEmail, | |
16 | fromName: options.fromName, | |
4e9fa5b7 | 17 | subject: options.subject, |
a4101923 C |
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 | } |