{"action":"created","comment":{"url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/comments/136336962","pull_request_review_id":59858855,"id":136336962,"diff_hunk":"@@ -28,3 +30,45 @@ describe('md5Hash', () => {\n     expect(fileNameHash).not.toBe(md5Hash(fileName));\n   });\n });\n+\n+describe('compressJPEG', () => {\n+  const filePath = './tmp/test.jpg';\n+\n+  beforeAll(() => {\n+    if (!fs.existsSync('./tmp')) fs.mkdirSync('./tmp');\n+\n+    // Copy compressible JPEG to `./tmp` directory to simulate JPEG upload\n+    return copyFile('./src/lib/__tests__/assets/compression-test.jpg', filePath);\n+  });\n+\n+  /*\n+   * We know compression-test.jpg will compress because it is a plain white image\n+   * However, not all images will compress depending on the complexity of the images\n+   */\n+  it('compresses compressible JPEG', () => {\n+    expect.assertions(1);\n+    const uncompressedSize = fs.statSync(filePath).size;\n+    return compressJPEG(filePath).then(() => {\n+      const compressedSize = fs.statSync(filePath).size;\n+      expect(uncompressedSize).toBeGreaterThan(compressedSize);\n+    });\n+  });\n+\n+  /* `./tmp/test.jpg` is already compressed from previous test */\n+  it(\"doesn't recompress already compressed JPEG\", () => {\n+    expect.assertions(1);\n+    const oldCompressedSize = fs.statSync(filePath).size;\n+    return compressJPEG(filePath).then(() => {\n+      const newCompressedSize = fs.statSync(filePath).size;\n+      expect(newCompressedSize).toEqual(oldCompressedSize);\n+    });\n+  });\n+\n+  /* Clears `./tmp` directory after compression and upload to S3 */\n+  it('deletes JPEG', () => {\n+    expect.assertions(1);\n+    return deleteFile(filePath).then(() => {","path":"src/lib/__tests__/server-utilities.test.js","position":51,"original_position":51,"commit_id":"6b33a5535776bc9a9bd4db36655e90e5f16cf0f9","original_commit_id":"6b33a5535776bc9a9bd4db36655e90e5f16cf0f9","user":{"login":"emilgoldsmith","id":18149242,"avatar_url":"https://avatars0.githubusercontent.com/u/18149242?v=4","gravatar_id":"","url":"https://api.github.com/users/emilgoldsmith","html_url":"https://github.com/emilgoldsmith","followers_url":"https://api.github.com/users/emilgoldsmith/followers","following_url":"https://api.github.com/users/emilgoldsmith/following{/other_user}","gists_url":"https://api.github.com/users/emilgoldsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/emilgoldsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emilgoldsmith/subscriptions","organizations_url":"https://api.github.com/users/emilgoldsmith/orgs","repos_url":"https://api.github.com/users/emilgoldsmith/repos","events_url":"https://api.github.com/users/emilgoldsmith/events{/privacy}","received_events_url":"https://api.github.com/users/emilgoldsmith/received_events","type":"User","site_admin":false},"body":"Yep also looks good :)","created_at":"2017-08-31T13:39:01Z","updated_at":"2017-08-31T13:46:44Z","html_url":"https://github.com/thegazelle-ad/gazelle-server/pull/193#discussion_r136336962","pull_request_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/comments/136336962"},"html":{"href":"https://github.com/thegazelle-ad/gazelle-server/pull/193#discussion_r136336962"},"pull_request":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193"}}},"pull_request":{"url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193","id":137809531,"html_url":"https://github.com/thegazelle-ad/gazelle-server/pull/193","diff_url":"https://github.com/thegazelle-ad/gazelle-server/pull/193.diff","patch_url":"https://github.com/thegazelle-ad/gazelle-server/pull/193.patch","issue_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/193","number":193,"state":"open","locked":false,"title":"Image upload compression","user":{"login":"zanemountcastle","id":9016615,"avatar_url":"https://avatars1.githubusercontent.com/u/9016615?v=4","gravatar_id":"","url":"https://api.github.com/users/zanemountcastle","html_url":"https://github.com/zanemountcastle","followers_url":"https://api.github.com/users/zanemountcastle/followers","following_url":"https://api.github.com/users/zanemountcastle/following{/other_user}","gists_url":"https://api.github.com/users/zanemountcastle/gists{/gist_id}","starred_url":"https://api.github.com/users/zanemountcastle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zanemountcastle/subscriptions","organizations_url":"https://api.github.com/users/zanemountcastle/orgs","repos_url":"https://api.github.com/users/zanemountcastle/repos","events_url":"https://api.github.com/users/zanemountcastle/events{/privacy}","received_events_url":"https://api.github.com/users/zanemountcastle/received_events","type":"User","site_admin":false},"body":"Added JPEG lossless compression algorithm to run just before uploading to Amazon S3.\r\n\r\nThis solves #37.\r\n","created_at":"2017-08-26T19:36:24Z","updated_at":"2017-08-31T13:46:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5e4a3f75d4773e1151db65ea84288088775a363","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193/commits","review_comments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193/comments","review_comment_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/193/comments","statuses_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/statuses/6b33a5535776bc9a9bd4db36655e90e5f16cf0f9","head":{"label":"thegazelle-ad:feature/image-compression","ref":"feature/image-compression","sha":"6b33a5535776bc9a9bd4db36655e90e5f16cf0f9","user":{"login":"thegazelle-ad","id":8604956,"avatar_url":"https://avatars3.githubusercontent.com/u/8604956?v=4","gravatar_id":"","url":"https://api.github.com/users/thegazelle-ad","html_url":"https://github.com/thegazelle-ad","followers_url":"https://api.github.com/users/thegazelle-ad/followers","following_url":"https://api.github.com/users/thegazelle-ad/following{/other_user}","gists_url":"https://api.github.com/users/thegazelle-ad/gists{/gist_id}","starred_url":"https://api.github.com/users/thegazelle-ad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegazelle-ad/subscriptions","organizations_url":"https://api.github.com/users/thegazelle-ad/orgs","repos_url":"https://api.github.com/users/thegazelle-ad/repos","events_url":"https://api.github.com/users/thegazelle-ad/events{/privacy}","received_events_url":"https://api.github.com/users/thegazelle-ad/received_events","type":"Organization","site_admin":false},"repo":{"id":60618027,"name":"gazelle-server","full_name":"thegazelle-ad/gazelle-server","owner":{"login":"thegazelle-ad","id":8604956,"avatar_url":"https://avatars3.githubusercontent.com/u/8604956?v=4","gravatar_id":"","url":"https://api.github.com/users/thegazelle-ad","html_url":"https://github.com/thegazelle-ad","followers_url":"https://api.github.com/users/thegazelle-ad/followers","following_url":"https://api.github.com/users/thegazelle-ad/following{/other_user}","gists_url":"https://api.github.com/users/thegazelle-ad/gists{/gist_id}","starred_url":"https://api.github.com/users/thegazelle-ad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegazelle-ad/subscriptions","organizations_url":"https://api.github.com/users/thegazelle-ad/orgs","repos_url":"https://api.github.com/users/thegazelle-ad/repos","events_url":"https://api.github.com/users/thegazelle-ad/events{/privacy}","received_events_url":"https://api.github.com/users/thegazelle-ad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thegazelle-ad/gazelle-server","description":"Server for front-end and editor tools of The Gazelle","fork":false,"url":"https://api.github.com/repos/thegazelle-ad/gazelle-server","forks_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/forks","keys_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/teams","hooks_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/hooks","issue_events_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/events{/number}","events_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/events","assignees_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/assignees{/user}","branches_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/branches{/branch}","tags_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/tags","blobs_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/statuses/{sha}","languages_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/languages","stargazers_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/stargazers","contributors_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/contributors","subscribers_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/subscribers","subscription_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/subscription","commits_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/contents/{+path}","compare_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/merges","archive_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/downloads","issues_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues{/number}","pulls_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls{/number}","milestones_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/milestones{/number}","notifications_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/labels{/name}","releases_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/releases{/id}","deployments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/deployments","created_at":"2016-06-07T14:04:28Z","updated_at":"2017-06-04T13:28:47Z","pushed_at":"2017-08-31T13:22:45Z","git_url":"git://github.com/thegazelle-ad/gazelle-server.git","ssh_url":"git@github.com:thegazelle-ad/gazelle-server.git","clone_url":"https://github.com/thegazelle-ad/gazelle-server.git","svn_url":"https://github.com/thegazelle-ad/gazelle-server","homepage":"","size":1944,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":85,"forks":4,"open_issues":85,"watchers":7,"default_branch":"master"}},"base":{"label":"thegazelle-ad:master","ref":"master","sha":"09028917d070c7a48f749fa2e109a747ee2f8e75","user":{"login":"thegazelle-ad","id":8604956,"avatar_url":"https://avatars3.githubusercontent.com/u/8604956?v=4","gravatar_id":"","url":"https://api.github.com/users/thegazelle-ad","html_url":"https://github.com/thegazelle-ad","followers_url":"https://api.github.com/users/thegazelle-ad/followers","following_url":"https://api.github.com/users/thegazelle-ad/following{/other_user}","gists_url":"https://api.github.com/users/thegazelle-ad/gists{/gist_id}","starred_url":"https://api.github.com/users/thegazelle-ad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegazelle-ad/subscriptions","organizations_url":"https://api.github.com/users/thegazelle-ad/orgs","repos_url":"https://api.github.com/users/thegazelle-ad/repos","events_url":"https://api.github.com/users/thegazelle-ad/events{/privacy}","received_events_url":"https://api.github.com/users/thegazelle-ad/received_events","type":"Organization","site_admin":false},"repo":{"id":60618027,"name":"gazelle-server","full_name":"thegazelle-ad/gazelle-server","owner":{"login":"thegazelle-ad","id":8604956,"avatar_url":"https://avatars3.githubusercontent.com/u/8604956?v=4","gravatar_id":"","url":"https://api.github.com/users/thegazelle-ad","html_url":"https://github.com/thegazelle-ad","followers_url":"https://api.github.com/users/thegazelle-ad/followers","following_url":"https://api.github.com/users/thegazelle-ad/following{/other_user}","gists_url":"https://api.github.com/users/thegazelle-ad/gists{/gist_id}","starred_url":"https://api.github.com/users/thegazelle-ad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thegazelle-ad/subscriptions","organizations_url":"https://api.github.com/users/thegazelle-ad/orgs","repos_url":"https://api.github.com/users/thegazelle-ad/repos","events_url":"https://api.github.com/users/thegazelle-ad/events{/privacy}","received_events_url":"https://api.github.com/users/thegazelle-ad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/thegazelle-ad/gazelle-server","description":"Server for front-end and editor tools of The Gazelle","fork":false,"url":"https://api.github.com/repos/thegazelle-ad/gazelle-server","forks_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/forks","keys_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/teams","hooks_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/hooks","issue_events_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/events{/number}","events_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/events","assignees_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/assignees{/user}","branches_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/branches{/branch}","tags_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/tags","blobs_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/statuses/{sha}","languages_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/languages","stargazers_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/stargazers","contributors_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/contributors","subscribers_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/subscribers","subscription_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/subscription","commits_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/contents/{+path}","compare_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/merges","archive_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/downloads","issues_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues{/number}","pulls_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls{/number}","milestones_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/milestones{/number}","notifications_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/labels{/name}","releases_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/releases{/id}","deployments_url":"https://api.github.com/repos/thegazelle-ad/gazelle-server/deployments","created_at":"2016-06-07T14:04:28Z","updated_at":"2017-06-04T13:28:47Z","pushed_at":"2017-08-31T13:22:45Z","git_url":"git://github.com/thegazelle-ad/gazelle-server.git","ssh_url":"git@github.com:thegazelle-ad/gazelle-server.git","clone_url":"https://github.com/thegazelle-ad/gazelle-server.git","svn_url":"https://github.com/thegazelle-ad/gazelle-server","homepage":"","size":1944,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":85,"forks":4,"open_issues":85,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193"},"html":{"href":"https://github.com/thegazelle-ad/gazelle-server/pull/193"},"issue":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/193"},"comments":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/issues/193/comments"},"review_comments":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193/comments"},"review_comment":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/pulls/193/commits"},"statuses":{"href":"https://api.github.com/repos/thegazelle-ad/gazelle-server/statuses/6b33a5535776bc9a9bd4db36655e90e5f16cf0f9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"emilgoldsmith"}}