{"action":"created","comment":{"url":"https://api.github.com/repos/tests-always-included/ddq/pulls/comments/80486905","id":80486905,"diff_hunk":"@@ -0,0 +1,400 @@\n+\"use strict\";\n+\n+describe(\"tests\", () => {\n+    var config, Ddq, events, mockRequire, timersMock;\n+\n+    mockRequire = require(\"mock-require\");\n+    beforeEach(() => {\n+        events = require(\"events\");\n+        timersMock = require(\"../mock/timers-mock\");\n+        config = {\n+            backend: \"mock\",\n+            backendConfig: {\n+                pollingDelay: 5000\n+            },\n+            heartbeatDelay: 1000,\n+            maxProcessingMessages: 2\n+        };\n+        Ddq = require(\"../../lib/ddq\")(events, timersMock);\n+    });\n+    describe(\".constructor()\", () => {\n+        it(\"can make a new DDQ\", () => {\n+            expect(() => {\n+                // eslint-disable-next-line no-new\n+                new Ddq(config);\n+            }).not.toThrow();\n+        });\n+        it(\"fails because of no config being passed\", () => {\n+            expect(() => {\n+                // eslint-disable-next-line no-new\n+                new Ddq();\n+            }).toThrow();\n+        });\n+    });\n+    describe(\".close()\", () => {\n+        beforeEach(() => {\n+            config.backendConfig.noPolling = true;\n+        });\n+        it(\"closes the polling of data\", (done) => {\n+            var ddq;\n+\n+            ddq = new Ddq(config);\n+            ddq.listen();\n+            ddq.close((err) => {\n+                expect(err).not.toBeDefined();\n+                done();\n+            });\n+        });\n+        it(\"fails closing the polling when calling backend to close\", (done) => {\n+            var ddq;\n+\n+            config.backendConfig.closeFail = true;\n+            ddq = new Ddq(config);\n+            ddq.listen();\n+            ddq.close((err) => {\n+                expect(err).toEqual(jasmine.any(Error));\n+                done();\n+            });\n+        });\n+        it(\"fails closing the polling when calling backend to close\", () => {\n+            var ddq;\n+\n+            ddq = new Ddq(config);\n+            ddq.listen();\n+            ddq.close();\n+        });\n+    });\n+    describe(\".destroy()\", () => {\n+        beforeEach(() => {\n+            config.backendConfig.noPolling = true;\n+        });\n+        it(\"calls the backend to close and is successful\", () => {\n+            var ddq;\n+\n+            ddq = new Ddq(config);\n+            ddq.backend.close = jasmine.createSpy(\"ddq.backend.close\");\n+            ddq.listen();\n+            ddq.destroy();\n+            expect(ddq.backend.close).toHaveBeenCalled();\n+        });\n+        it(\"calls the backend to close and the backend fails\", (done) => {\n+            var ddq;\n+\n+            config.backendConfig.closeFail = true;\n+            ddq = new Ddq(config);\n+            ddq.on(\"error\", (err) => {\n+                expect(err).toEqual(jasmine.any(Error));\n+                done();\n+            });\n+            ddq.listen();\n+            ddq.destroy();\n+        });\n+        it(\"calls the backend to close and the backend returns false\", (done) => {\n+            var ddq;\n+\n+            ddq = new Ddq(config);\n+            ddq.backend.close = jasmine.createSpy(\"ddq.backend.close\")\n+                .andCallFake((callback) => {\n+                    callback(false);\n+                    done();\n+                });\n+            ddq.on(\"error\", (err) => {\n+                expect(err).toEqual(false);\n+                done();\n+            });\n+            ddq.listen();\n+            ddq.destroy();\n+        });\n+    });\n+    describe(\".listen()\", () => {\n+        it(\"starts listening on the backend\", () => {\n+            var ddq;\n+\n+            ddq = new Ddq(config);\n+            ddq.backend.listen = jasmine.createSpy(\"ddq.backend.listen\");\n+            ddq.listen();\n+            expect(ddq.backend.listen).toHaveBeenCalled();\n+        });\n+    });\n+    describe(\"error event\", () => {\n+        var ddq;\n+\n+        beforeEach(() => {\n+            config.backendConfig.noPolling = true;\n+            ddq = new Ddq(config);\n+            ddq.listen();\n+        });\n+        it(\"is forwarded\", (done) => {\n+            ddq.on(\"error\", (err) => {\n+                expect(err).toBe(\"some error\");\n+                done();\n+            });\n+            ddq.backend.emit(\"error\", \"some error\");\n+        });\n+    });\n+    describe(\"data event\", () => {\n+        var ddq, wrappedMessage;\n+\n+        beforeEach(() => {\n+            config.backendConfig.noPolling = true;\n+            ddq = new Ddq(config);\n+            ddq.listen();\n+            wrappedMessage = require(\"../mock/wrapped-message-mock\");\n+        });\n+        afterEach(() => {\n+            ddq.messagesBeingProcessed = 0;\n+            wrappedMessage = null;\n+        });\n+        it(\"requeues when polling was stopped and does not trigger a 'data' event\", (done) => {\n+            var failed;\n+\n+            failed = false;\n+            ddq.on(\"data\", () => {\n+                // Should not ever call this\n+                failed = true;\n+            });\n+            ddq.pausePolling();\n+            ddq.backend.emit(\"data\", wrappedMessage);\n+            expect(wrappedMessage.requeue).toHaveBeenCalled();\n+            expect(wrappedMessage.heartbeatKill).not.toHaveBeenCalled();","path":"spec/lib/ddq.spec.js","position":159,"original_position":159,"commit_id":"1be213bb1a91998f63ba86ed1f2afd38885dc9e8","original_commit_id":"16bb187725af73905790f4e0910a4a89c694065e","user":{"login":"AbsentSemicolon","id":1569396,"avatar_url":"https://avatars.githubusercontent.com/u/1569396?v=3","gravatar_id":"","url":"https://api.github.com/users/AbsentSemicolon","html_url":"https://github.com/AbsentSemicolon","followers_url":"https://api.github.com/users/AbsentSemicolon/followers","following_url":"https://api.github.com/users/AbsentSemicolon/following{/other_user}","gists_url":"https://api.github.com/users/AbsentSemicolon/gists{/gist_id}","starred_url":"https://api.github.com/users/AbsentSemicolon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AbsentSemicolon/subscriptions","organizations_url":"https://api.github.com/users/AbsentSemicolon/orgs","repos_url":"https://api.github.com/users/AbsentSemicolon/repos","events_url":"https://api.github.com/users/AbsentSemicolon/events{/privacy}","received_events_url":"https://api.github.com/users/AbsentSemicolon/received_events","type":"User","site_admin":false},"body":"Removed","created_at":"2016-09-26T14:26:41Z","updated_at":"2016-09-26T14:26:41Z","html_url":"https://github.com/tests-always-included/ddq/pull/1#discussion_r80486905","pull_request_url":"https://api.github.com/repos/tests-always-included/ddq/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/comments/80486905"},"html":{"href":"https://github.com/tests-always-included/ddq/pull/1#discussion_r80486905"},"pull_request":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/tests-always-included/ddq/pulls/1","id":86235402,"html_url":"https://github.com/tests-always-included/ddq/pull/1","diff_url":"https://github.com/tests-always-included/ddq/pull/1.diff","patch_url":"https://github.com/tests-always-included/ddq/pull/1.patch","issue_url":"https://api.github.com/repos/tests-always-included/ddq/issues/1","number":1,"state":"open","locked":false,"title":"Release 1","user":{"login":"AbsentSemicolon","id":1569396,"avatar_url":"https://avatars.githubusercontent.com/u/1569396?v=3","gravatar_id":"","url":"https://api.github.com/users/AbsentSemicolon","html_url":"https://github.com/AbsentSemicolon","followers_url":"https://api.github.com/users/AbsentSemicolon/followers","following_url":"https://api.github.com/users/AbsentSemicolon/following{/other_user}","gists_url":"https://api.github.com/users/AbsentSemicolon/gists{/gist_id}","starred_url":"https://api.github.com/users/AbsentSemicolon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AbsentSemicolon/subscriptions","organizations_url":"https://api.github.com/users/AbsentSemicolon/orgs","repos_url":"https://api.github.com/users/AbsentSemicolon/repos","events_url":"https://api.github.com/users/AbsentSemicolon/events{/privacy}","received_events_url":"https://api.github.com/users/AbsentSemicolon/received_events","type":"User","site_admin":false},"body":"This is the first release of DDQ. This includes all files to get it working except for a backend which is presenting still in Github.\r\n\r\nIncludes a few example scripts to see it in action provided the mock backend has been pulled in.","created_at":"2016-09-21T20:28:56Z","updated_at":"2016-09-26T14:26:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66a25c5920944f8bc6f7dadd0711b986e9900265","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tests-always-included/ddq/pulls/1/commits","review_comments_url":"https://api.github.com/repos/tests-always-included/ddq/pulls/1/comments","review_comment_url":"https://api.github.com/repos/tests-always-included/ddq/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tests-always-included/ddq/issues/1/comments","statuses_url":"https://api.github.com/repos/tests-always-included/ddq/statuses/1be213bb1a91998f63ba86ed1f2afd38885dc9e8","head":{"label":"AbsentSemicolon:release-1","ref":"release-1","sha":"1be213bb1a91998f63ba86ed1f2afd38885dc9e8","user":{"login":"AbsentSemicolon","id":1569396,"avatar_url":"https://avatars.githubusercontent.com/u/1569396?v=3","gravatar_id":"","url":"https://api.github.com/users/AbsentSemicolon","html_url":"https://github.com/AbsentSemicolon","followers_url":"https://api.github.com/users/AbsentSemicolon/followers","following_url":"https://api.github.com/users/AbsentSemicolon/following{/other_user}","gists_url":"https://api.github.com/users/AbsentSemicolon/gists{/gist_id}","starred_url":"https://api.github.com/users/AbsentSemicolon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AbsentSemicolon/subscriptions","organizations_url":"https://api.github.com/users/AbsentSemicolon/orgs","repos_url":"https://api.github.com/users/AbsentSemicolon/repos","events_url":"https://api.github.com/users/AbsentSemicolon/events{/privacy}","received_events_url":"https://api.github.com/users/AbsentSemicolon/received_events","type":"User","site_admin":false},"repo":{"id":67234231,"name":"ddq","full_name":"AbsentSemicolon/ddq","owner":{"login":"AbsentSemicolon","id":1569396,"avatar_url":"https://avatars.githubusercontent.com/u/1569396?v=3","gravatar_id":"","url":"https://api.github.com/users/AbsentSemicolon","html_url":"https://github.com/AbsentSemicolon","followers_url":"https://api.github.com/users/AbsentSemicolon/followers","following_url":"https://api.github.com/users/AbsentSemicolon/following{/other_user}","gists_url":"https://api.github.com/users/AbsentSemicolon/gists{/gist_id}","starred_url":"https://api.github.com/users/AbsentSemicolon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AbsentSemicolon/subscriptions","organizations_url":"https://api.github.com/users/AbsentSemicolon/orgs","repos_url":"https://api.github.com/users/AbsentSemicolon/repos","events_url":"https://api.github.com/users/AbsentSemicolon/events{/privacy}","received_events_url":"https://api.github.com/users/AbsentSemicolon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AbsentSemicolon/ddq","description":"DeDuplicated Queue","fork":true,"url":"https://api.github.com/repos/AbsentSemicolon/ddq","forks_url":"https://api.github.com/repos/AbsentSemicolon/ddq/forks","keys_url":"https://api.github.com/repos/AbsentSemicolon/ddq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AbsentSemicolon/ddq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AbsentSemicolon/ddq/teams","hooks_url":"https://api.github.com/repos/AbsentSemicolon/ddq/hooks","issue_events_url":"https://api.github.com/repos/AbsentSemicolon/ddq/issues/events{/number}","events_url":"https://api.github.com/repos/AbsentSemicolon/ddq/events","assignees_url":"https://api.github.com/repos/AbsentSemicolon/ddq/assignees{/user}","branches_url":"https://api.github.com/repos/AbsentSemicolon/ddq/branches{/branch}","tags_url":"https://api.github.com/repos/AbsentSemicolon/ddq/tags","blobs_url":"https://api.github.com/repos/AbsentSemicolon/ddq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AbsentSemicolon/ddq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AbsentSemicolon/ddq/git/refs{/sha}","trees_url":"https://api.github.com/repos/AbsentSemicolon/ddq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AbsentSemicolon/ddq/statuses/{sha}","languages_url":"https://api.github.com/repos/AbsentSemicolon/ddq/languages","stargazers_url":"https://api.github.com/repos/AbsentSemicolon/ddq/stargazers","contributors_url":"https://api.github.com/repos/AbsentSemicolon/ddq/contributors","subscribers_url":"https://api.github.com/repos/AbsentSemicolon/ddq/subscribers","subscription_url":"https://api.github.com/repos/AbsentSemicolon/ddq/subscription","commits_url":"https://api.github.com/repos/AbsentSemicolon/ddq/commits{/sha}","git_commits_url":"https://api.github.com/repos/AbsentSemicolon/ddq/git/commits{/sha}","comments_url":"https://api.github.com/repos/AbsentSemicolon/ddq/comments{/number}","issue_comment_url":"https://api.github.com/repos/AbsentSemicolon/ddq/issues/comments{/number}","contents_url":"https://api.github.com/repos/AbsentSemicolon/ddq/contents/{+path}","compare_url":"https://api.github.com/repos/AbsentSemicolon/ddq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AbsentSemicolon/ddq/merges","archive_url":"https://api.github.com/repos/AbsentSemicolon/ddq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AbsentSemicolon/ddq/downloads","issues_url":"https://api.github.com/repos/AbsentSemicolon/ddq/issues{/number}","pulls_url":"https://api.github.com/repos/AbsentSemicolon/ddq/pulls{/number}","milestones_url":"https://api.github.com/repos/AbsentSemicolon/ddq/milestones{/number}","notifications_url":"https://api.github.com/repos/AbsentSemicolon/ddq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AbsentSemicolon/ddq/labels{/name}","releases_url":"https://api.github.com/repos/AbsentSemicolon/ddq/releases{/id}","deployments_url":"https://api.github.com/repos/AbsentSemicolon/ddq/deployments","created_at":"2016-09-02T15:31:00Z","updated_at":"2016-09-02T15:30:44Z","pushed_at":"2016-09-23T13:43:18Z","git_url":"git://github.com/AbsentSemicolon/ddq.git","ssh_url":"git@github.com:AbsentSemicolon/ddq.git","clone_url":"https://github.com/AbsentSemicolon/ddq.git","svn_url":"https://github.com/AbsentSemicolon/ddq","homepage":null,"size":45,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tests-always-included:master","ref":"master","sha":"7e7bef1fb6073dc61857fd7c6cd33a2939fade77","user":{"login":"tests-always-included","id":6856312,"avatar_url":"https://avatars.githubusercontent.com/u/6856312?v=3","gravatar_id":"","url":"https://api.github.com/users/tests-always-included","html_url":"https://github.com/tests-always-included","followers_url":"https://api.github.com/users/tests-always-included/followers","following_url":"https://api.github.com/users/tests-always-included/following{/other_user}","gists_url":"https://api.github.com/users/tests-always-included/gists{/gist_id}","starred_url":"https://api.github.com/users/tests-always-included/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tests-always-included/subscriptions","organizations_url":"https://api.github.com/users/tests-always-included/orgs","repos_url":"https://api.github.com/users/tests-always-included/repos","events_url":"https://api.github.com/users/tests-always-included/events{/privacy}","received_events_url":"https://api.github.com/users/tests-always-included/received_events","type":"Organization","site_admin":false},"repo":{"id":67234207,"name":"ddq","full_name":"tests-always-included/ddq","owner":{"login":"tests-always-included","id":6856312,"avatar_url":"https://avatars.githubusercontent.com/u/6856312?v=3","gravatar_id":"","url":"https://api.github.com/users/tests-always-included","html_url":"https://github.com/tests-always-included","followers_url":"https://api.github.com/users/tests-always-included/followers","following_url":"https://api.github.com/users/tests-always-included/following{/other_user}","gists_url":"https://api.github.com/users/tests-always-included/gists{/gist_id}","starred_url":"https://api.github.com/users/tests-always-included/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tests-always-included/subscriptions","organizations_url":"https://api.github.com/users/tests-always-included/orgs","repos_url":"https://api.github.com/users/tests-always-included/repos","events_url":"https://api.github.com/users/tests-always-included/events{/privacy}","received_events_url":"https://api.github.com/users/tests-always-included/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/tests-always-included/ddq","description":"DeDuplicated Queue","fork":false,"url":"https://api.github.com/repos/tests-always-included/ddq","forks_url":"https://api.github.com/repos/tests-always-included/ddq/forks","keys_url":"https://api.github.com/repos/tests-always-included/ddq/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tests-always-included/ddq/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tests-always-included/ddq/teams","hooks_url":"https://api.github.com/repos/tests-always-included/ddq/hooks","issue_events_url":"https://api.github.com/repos/tests-always-included/ddq/issues/events{/number}","events_url":"https://api.github.com/repos/tests-always-included/ddq/events","assignees_url":"https://api.github.com/repos/tests-always-included/ddq/assignees{/user}","branches_url":"https://api.github.com/repos/tests-always-included/ddq/branches{/branch}","tags_url":"https://api.github.com/repos/tests-always-included/ddq/tags","blobs_url":"https://api.github.com/repos/tests-always-included/ddq/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tests-always-included/ddq/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tests-always-included/ddq/git/refs{/sha}","trees_url":"https://api.github.com/repos/tests-always-included/ddq/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tests-always-included/ddq/statuses/{sha}","languages_url":"https://api.github.com/repos/tests-always-included/ddq/languages","stargazers_url":"https://api.github.com/repos/tests-always-included/ddq/stargazers","contributors_url":"https://api.github.com/repos/tests-always-included/ddq/contributors","subscribers_url":"https://api.github.com/repos/tests-always-included/ddq/subscribers","subscription_url":"https://api.github.com/repos/tests-always-included/ddq/subscription","commits_url":"https://api.github.com/repos/tests-always-included/ddq/commits{/sha}","git_commits_url":"https://api.github.com/repos/tests-always-included/ddq/git/commits{/sha}","comments_url":"https://api.github.com/repos/tests-always-included/ddq/comments{/number}","issue_comment_url":"https://api.github.com/repos/tests-always-included/ddq/issues/comments{/number}","contents_url":"https://api.github.com/repos/tests-always-included/ddq/contents/{+path}","compare_url":"https://api.github.com/repos/tests-always-included/ddq/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tests-always-included/ddq/merges","archive_url":"https://api.github.com/repos/tests-always-included/ddq/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tests-always-included/ddq/downloads","issues_url":"https://api.github.com/repos/tests-always-included/ddq/issues{/number}","pulls_url":"https://api.github.com/repos/tests-always-included/ddq/pulls{/number}","milestones_url":"https://api.github.com/repos/tests-always-included/ddq/milestones{/number}","notifications_url":"https://api.github.com/repos/tests-always-included/ddq/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tests-always-included/ddq/labels{/name}","releases_url":"https://api.github.com/repos/tests-always-included/ddq/releases{/id}","deployments_url":"https://api.github.com/repos/tests-always-included/ddq/deployments","created_at":"2016-09-02T15:30:44Z","updated_at":"2016-09-02T15:30:44Z","pushed_at":"2016-09-23T13:43:19Z","git_url":"git://github.com/tests-always-included/ddq.git","ssh_url":"git@github.com:tests-always-included/ddq.git","clone_url":"https://github.com/tests-always-included/ddq.git","svn_url":"https://github.com/tests-always-included/ddq","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/1"},"html":{"href":"https://github.com/tests-always-included/ddq/pull/1"},"issue":{"href":"https://api.github.com/repos/tests-always-included/ddq/issues/1"},"comments":{"href":"https://api.github.com/repos/tests-always-included/ddq/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tests-always-included/ddq/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/tests-always-included/ddq/statuses/1be213bb1a91998f63ba86ed1f2afd38885dc9e8"}}}}
{"actor":{"display_login":"AbsentSemicolon"}}