]>
Commit | Line | Data |
---|---|---|
a4101923 C |
1 | import * as request from 'supertest' |
2 | import { ContactForm } from '../../models/server' | |
3 | ||
4 | function sendContactForm (options: { | |
5 | url: string, | |
6 | fromEmail: string, | |
7 | fromName: string, | |
8 | body: string, | |
9 | expectedStatus?: number | |
10 | }) { | |
11 | const path = '/api/v1/server/contact' | |
12 | ||
13 | const body: ContactForm = { | |
14 | fromEmail: options.fromEmail, | |
15 | fromName: options.fromName, | |
16 | body: options.body | |
17 | } | |
18 | return request(options.url) | |
19 | .post(path) | |
20 | .send(body) | |
21 | .expect(options.expectedStatus || 204) | |
22 | } | |
23 | ||
24 | // --------------------------------------------------------------------------- | |
25 | ||
26 | export { | |
27 | sendContactForm | |
28 | } |