-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathattachment_fixtures.js
More file actions
66 lines (58 loc) · 1.78 KB
/
attachment_fixtures.js
File metadata and controls
66 lines (58 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
'use strict';
/**
* This file defines what various attachments that you might want to use in your tests
* They are used by default in the incoming_updates and outgoing_messages
* fixtures where appropriate
*/
const audioAttachment = () => ({
type: 'audio',
payload: {
url: 'SOME_AUDIO_URL',
},
});
const fileAttachment = () => ({
type: 'file',
payload: {
url: 'SOME_FILE_URL',
},
});
const imageAttachment = () => ({
type: 'image',
payload: {
url: 'SOME_IMAGE_URL',
},
});
const videoAttachment = () => ({
type: 'file',
payload: {
url: 'SOME_VIDEO_URL',
},
});
// These can happen when e.g. A user sends simply a URL that links to an image
// or some other kind of media. Messenger will for some reason create a fallback
// type of attachment with its own facebook URL for it (i.e. it stores the sent media file)
const payloadAttachment = () => ({
title: 'i0.wp.com',
url: 'https://l.facebook.com/l.php?u=http%3A%2F%2Fi0.wp.com%2Fwww.developermemes.com%2Fwp-content%2Fuploads%2F2015%2F10%2FNow-That-You-Have-That-Feature-Done-I-Want-It-To-Do-Something-Else-Instead-Web-Developer-Meme.jpg%3Fresize%3D385%252C232&h=ATPVmc3aARMYIBYm5A3P16ERZ9KQPGXGEkAgoohtJVfayD7cjxh8laOnTHgJV0h_sEy3fQKotP3uuV1DBF7H09Gyy4i6-EsJ8oue8cIo8-KKJQIJrYP2IWk-b_BCOJYhRPlQObI&s=1&enc=AZOXAWT_VFtoYxZSN3iWPWVliiNkIImqgVQtl43-Ec01qfwYLsKmSdZJ-tdBwOvuhnKpymCXe_1dYVRFQ9APT5y5',
type: 'fallback',
payload: null,
});
const locationAttachment = () => ({
title: 'Pinned Location',
url: 'https://maps.google.com/?q=51.524498,-0.076595',
type: 'location',
payload: {
coordinates: {
lat: 51.524498,
long: -0.076595,
},
},
});
module.exports = {
audioAttachment,
fileAttachment,
imageAttachment,
videoAttachment,
payloadAttachment,
locationAttachment,
};