Skip to content

Commit

Permalink
feat: add realistic giphy attachment generator
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinCupela committed Jul 8, 2022
1 parent aa1624a commit e4c2a7b
Showing 1 changed file with 90 additions and 32 deletions.
122 changes: 90 additions & 32 deletions src/mock-builders/generator/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@ export const generateAttachmentAction = (a) => ({
...a,
});

export const generateScrapedDataAttachment = (a) => ({
og_scrape_url: nanoid(),
title_link: nanoid(),
export const generateFileAttachment = (a) => ({
asset_url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
file_size: 1337,
mime_type: 'application/pdf',
title: nanoid(),
type: 'file',
...a,
});

export const generateImageAttachment = (a) => ({
fallback: nanoid(),
image_url: nanoid(),
type: 'image',
...a,
});

Expand All @@ -22,23 +32,18 @@ export const generateVideoAttachment = (a) => ({
...a,
});

export const generateScrapedVideoAttachment = (a) => ({
...generateScrapedDataAttachment({
asset_url: nanoid(),
author_name: nanoid(),
image_url: nanoid(),
text: nanoid(),
thumb_url: nanoid(),
title: nanoid(),
type: 'video',
}),
export const generateAudioAttachment = (a) => ({
asset_url: 'http://www.jackblack.com/tribute.mp3',
file_size: 36132,
mime_type: 'audio/mpeg',
title: nanoid(),
type: 'audio',
...a,
});

export const generateImageAttachment = (a) => ({
fallback: nanoid(),
image_url: nanoid(),
type: 'image',
export const generateScrapedDataAttachment = (a) => ({
og_scrape_url: nanoid(),
title_link: nanoid(),
...a,
});

Expand All @@ -54,12 +59,16 @@ export const generateScrapedImageAttachment = (a) => ({
...a,
});

export const generateAudioAttachment = (a) => ({
asset_url: 'http://www.jackblack.com/tribute.mp3',
file_size: 36132,
mime_type: 'audio/mpeg',
title: nanoid(),
type: 'audio',
export const generateScrapedVideoAttachment = (a) => ({
...generateScrapedDataAttachment({
asset_url: nanoid(),
author_name: nanoid(),
image_url: nanoid(),
text: nanoid(),
thumb_url: nanoid(),
title: nanoid(),
type: 'video',
}),
...a,
});

Expand All @@ -77,16 +86,65 @@ export const generateScrapedAudioAttachment = (a) => ({
...a,
});

export const generateFileAttachment = (a) => ({
asset_url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
file_size: 1337,
mime_type: 'application/pdf',
title: nanoid(),
type: 'file',
...a,
});

export const generateGiphyAttachment = (a) => ({
giphy: {
fixed_height: {
frames: '',
height: '200',
size: '445149',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200.gif&ct=g',
width: '200',
},
fixed_height_downsampled: {
frames: '',
height: '200',
size: '148168',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200_d.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200_d.gif&ct=g',
width: '200',
},
fixed_height_still: {
frames: '',
height: '200',
size: '23240',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200_s.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200_s.gif&ct=g',
width: '200',
},
fixed_width: {
frames: '',
height: '200',
size: '445149',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200w.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200w.gif&ct=g',
width: '200',
},
fixed_width_downsampled: {
frames: '',
height: '200',
size: '148168',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200w_d.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200w_d.gif&ct=g',
width: '200',
},
fixed_width_still: {
frames: '',
height: '200',
size: '23240',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/200w_s.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=200w_s.gif&ct=g',
width: '200',
},
original: {
frames: '20',
height: '400',
size: '1308571',
url:
'https://media2.giphy.com/media/j5L4RHeV8Q5tmepRVb/giphy.gif?cid=c4b03675kgziudvt7s9990i28hp8zpffi4oyem1snvl7sfvl&rid=giphy.gif&ct=g',
width: '400',
},
},
thumb_url: 'http://www.jackblack.com/tenac_iousd.bmp',
title: nanoid(),
title_link: nanoid(),
Expand Down

0 comments on commit e4c2a7b

Please sign in to comment.