Skip to content

Conversation

@caspiano
Copy link

@caspiano caspiano commented Jul 5, 2018

No description provided.

@caspiano caspiano requested a review from sabrehagen July 5, 2018 00:19
response = await sendSlackNotification();
});

it('requests the correct domain', () => expect(requestUrl).toBe(url));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 expect(requestUrl).toBe(url);
 expect(response.status).toBe(200);
 expect(requestBody.channel).toBe(channel);
 expect(requestBody.text).toBe(text);

/**
* @TJS-type email
*/
to: string[];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls add description

console.log(`Failed to send Slack message: Received ${res.status} ${ res.statusText }` )
Promise.reject(new Error('Failed to send Slack message'))
}
return Promise.resolve(res);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what?

@@ -0,0 +1,8 @@
{
"extends":[
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What?

export function checkWithinAttachmentLimit (filepaths: string[], limit: number) {
const getFileSize = (filepath: string) => stat(filepath).then((stats) => stats.size);

return Bluebird.map(filepaths, getFileSize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to use Ramda

const getFileSize = (filepath: string) => stat(filepath).then((stats) => stats.size);
const getFilesSize = (filePaths: string[]) => pipeP(map(getFileSize),  sum)(filepaths)
const checkWithinAttachmentLimit = (filepaths: string[], limit: number)  =>  getFilesSize(filePaths) < limit

@caspiano caspiano closed this May 30, 2021
@sabrehagen sabrehagen reopened this Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants