{"action":"created","comment":{"url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/comments/62309428","id":62309428,"diff_hunk":"@@ -0,0 +1,65 @@\n+///<reference path=\"../main/DatabaseAdapter.ts\"/>\n+\n+describe(\"A DatabaseAdapter\", function() {\n+    let adapter: DatabaseAdapter;\n+\n+    beforeEach(function() {\n+        jasmine.Ajax.install();\n+\n+        adapter = new DatabaseAdapter(\"http://localhost:8000\");\n+        jasmine.Ajax.requests.mostRecent().respondWith({\n+            contentType: \"text/json\",\n+            responseText: '{\"url\":\"http://localhost:8000/api/users/42/\",\"username\":\"Travis\"}',\n+            status: 201,\n+        });\n+    });\n+\n+    afterEach(function() {\n+        delete adapter;\n+        jasmine.Ajax.uninstall();\n+    });\n+\n+    it(\"correctly saves the url with trailing slash\", function() {\n+        expect(adapter.url).toBe(\"http://localhost:8000/\");\n+    });\n+\n+    it(\"correctly initializes on init\", function() {\n+        expect(adapter.isInitialized).toBe(true);\n+    });\n+\n+    it(\"correctly sets the session number\", function() {\n+        expect(adapter.session).toBe(42);\n+    });\n+\n+    it(\"can post to the API\", function() {\n+        const spyFunc = jasmine.createSpy(\"success\");\n+\n+        adapter.post(1, new Date(), 100, spyFunc);\n+\n+        jasmine.Ajax.requests.mostRecent().respondWith({\n+            contentType: \"text/json\",\n+            responseText: JSON.stringify({success: true}),\n+            status: 201,\n+        });\n+\n+        expect(spyFunc).toHaveBeenCalled();\n+        expect(spyFunc.calls.mostRecent().args[0]).toEqual({success: true});\n+    });\n+\n+    it(\"can be set to debug mode\", function() {\n+        const consoleSpy = spyOn(console, \"log\");\n+\n+        adapter.setDebug();\n+\n+        adapter.post(1, new Date(), 100, function(data) {return data; });\n+        jasmine.Ajax.requests.mostRecent().respondWith({\n+            contentType: \"text/json\",\n+            responseText: JSON.stringify({success: true}),\n+            status: 201,\n+        });\n+\n+        expect(consoleSpy).toHaveBeenCalledTimes(2);\n+        expect(consoleSpy.calls.all()[0].args[0]).toBe(\"Sent out AJAX request: \");\n+        expect(consoleSpy.calls.all()[1].args[0]).toBe(\"Call success, status: success\");\n+    });","path":"src/octopeer-github/test/DatabaseAdapterTest.ts","position":64,"original_position":64,"commit_id":"6ae0be8a82a01da43a61644da1f3ffcbc864910f","original_commit_id":"6ae0be8a82a01da43a61644da1f3ffcbc864910f","user":{"login":"Exclaminator","id":475427,"avatar_url":"https://avatars.githubusercontent.com/u/475427?v=3","gravatar_id":"","url":"https://api.github.com/users/Exclaminator","html_url":"https://github.com/Exclaminator","followers_url":"https://api.github.com/users/Exclaminator/followers","following_url":"https://api.github.com/users/Exclaminator/following{/other_user}","gists_url":"https://api.github.com/users/Exclaminator/gists{/gist_id}","starred_url":"https://api.github.com/users/Exclaminator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Exclaminator/subscriptions","organizations_url":"https://api.github.com/users/Exclaminator/orgs","repos_url":"https://api.github.com/users/Exclaminator/repos","events_url":"https://api.github.com/users/Exclaminator/events{/privacy}","received_events_url":"https://api.github.com/users/Exclaminator/received_events","type":"User","site_admin":false},"body":"Nice idea, I wouldn't have thought of log testing","created_at":"2016-05-06T09:50:37Z","updated_at":"2016-05-06T09:50:37Z","html_url":"https://github.com/thervh70/ContextProject_RDD/pull/21#discussion_r62309428","pull_request_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21","_links":{"self":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/comments/62309428"},"html":{"href":"https://github.com/thervh70/ContextProject_RDD/pull/21#discussion_r62309428"},"pull_request":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21"}}},"pull_request":{"url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21","id":69125093,"html_url":"https://github.com/thervh70/ContextProject_RDD/pull/21","diff_url":"https://github.com/thervh70/ContextProject_RDD/pull/21.diff","patch_url":"https://github.com/thervh70/ContextProject_RDD/pull/21.patch","issue_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/21","number":21,"state":"open","locked":false,"title":"5 connect database api","user":{"login":"mpsijm","id":9739541,"avatar_url":"https://avatars.githubusercontent.com/u/9739541?v=3","gravatar_id":"","url":"https://api.github.com/users/mpsijm","html_url":"https://github.com/mpsijm","followers_url":"https://api.github.com/users/mpsijm/followers","following_url":"https://api.github.com/users/mpsijm/following{/other_user}","gists_url":"https://api.github.com/users/mpsijm/gists{/gist_id}","starred_url":"https://api.github.com/users/mpsijm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpsijm/subscriptions","organizations_url":"https://api.github.com/users/mpsijm/orgs","repos_url":"https://api.github.com/users/mpsijm/repos","events_url":"https://api.github.com/users/mpsijm/events{/privacy}","received_events_url":"https://api.github.com/users/mpsijm/received_events","type":"User","site_admin":false},"body":"Will close #5 \r\n\r\nI have written a DatabaseAdapter which connects with the database provided by Aaron.\r\nIt contains only the functionality that the database currently provides, and will have to be extended once the database meets our needs.\r\nIt also has a debug functionality which logs more verbosely to the console.","created_at":"2016-05-06T09:23:14Z","updated_at":"2016-05-06T09:50:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1af5790bc58d278587e6cbc14ea6e18d1b4db848","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21/commits","review_comments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21/comments","review_comment_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/comments{/number}","comments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/21/comments","statuses_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/statuses/6ae0be8a82a01da43a61644da1f3ffcbc864910f","head":{"label":"thervh70:5-connect-database-api","ref":"5-connect-database-api","sha":"6ae0be8a82a01da43a61644da1f3ffcbc864910f","user":{"login":"thervh70","id":9721657,"avatar_url":"https://avatars.githubusercontent.com/u/9721657?v=3","gravatar_id":"","url":"https://api.github.com/users/thervh70","html_url":"https://github.com/thervh70","followers_url":"https://api.github.com/users/thervh70/followers","following_url":"https://api.github.com/users/thervh70/following{/other_user}","gists_url":"https://api.github.com/users/thervh70/gists{/gist_id}","starred_url":"https://api.github.com/users/thervh70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thervh70/subscriptions","organizations_url":"https://api.github.com/users/thervh70/orgs","repos_url":"https://api.github.com/users/thervh70/repos","events_url":"https://api.github.com/users/thervh70/events{/privacy}","received_events_url":"https://api.github.com/users/thervh70/received_events","type":"User","site_admin":false},"repo":{"id":56582349,"name":"ContextProject_RDD","full_name":"thervh70/ContextProject_RDD","owner":{"login":"thervh70","id":9721657,"avatar_url":"https://avatars.githubusercontent.com/u/9721657?v=3","gravatar_id":"","url":"https://api.github.com/users/thervh70","html_url":"https://github.com/thervh70","followers_url":"https://api.github.com/users/thervh70/followers","following_url":"https://api.github.com/users/thervh70/following{/other_user}","gists_url":"https://api.github.com/users/thervh70/gists{/gist_id}","starred_url":"https://api.github.com/users/thervh70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thervh70/subscriptions","organizations_url":"https://api.github.com/users/thervh70/orgs","repos_url":"https://api.github.com/users/thervh70/repos","events_url":"https://api.github.com/users/thervh70/events{/privacy}","received_events_url":"https://api.github.com/users/thervh70/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thervh70/ContextProject_RDD","description":"","fork":false,"url":"https://api.github.com/repos/thervh70/ContextProject_RDD","forks_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/forks","keys_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/teams","hooks_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/hooks","issue_events_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/events{/number}","events_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/events","assignees_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/assignees{/user}","branches_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/branches{/branch}","tags_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/tags","blobs_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/refs{/sha}","trees_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/statuses/{sha}","languages_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/languages","stargazers_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/stargazers","contributors_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/contributors","subscribers_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/subscribers","subscription_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/subscription","commits_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/commits{/sha}","git_commits_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/commits{/sha}","comments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/comments{/number}","issue_comment_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/comments{/number}","contents_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/contents/{+path}","compare_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/merges","archive_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/downloads","issues_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues{/number}","pulls_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls{/number}","milestones_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/milestones{/number}","notifications_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/labels{/name}","releases_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/releases{/id}","deployments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/deployments","created_at":"2016-04-19T09:12:06Z","updated_at":"2016-04-25T14:54:33Z","pushed_at":"2016-05-06T09:44:27Z","git_url":"git://github.com/thervh70/ContextProject_RDD.git","ssh_url":"git@github.com:thervh70/ContextProject_RDD.git","clone_url":"https://github.com/thervh70/ContextProject_RDD.git","svn_url":"https://github.com/thervh70/ContextProject_RDD","homepage":null,"size":2143,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"base":{"label":"thervh70:dev","ref":"dev","sha":"db5c4181d754c0fc176adf4aa675d1595a2ef709","user":{"login":"thervh70","id":9721657,"avatar_url":"https://avatars.githubusercontent.com/u/9721657?v=3","gravatar_id":"","url":"https://api.github.com/users/thervh70","html_url":"https://github.com/thervh70","followers_url":"https://api.github.com/users/thervh70/followers","following_url":"https://api.github.com/users/thervh70/following{/other_user}","gists_url":"https://api.github.com/users/thervh70/gists{/gist_id}","starred_url":"https://api.github.com/users/thervh70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thervh70/subscriptions","organizations_url":"https://api.github.com/users/thervh70/orgs","repos_url":"https://api.github.com/users/thervh70/repos","events_url":"https://api.github.com/users/thervh70/events{/privacy}","received_events_url":"https://api.github.com/users/thervh70/received_events","type":"User","site_admin":false},"repo":{"id":56582349,"name":"ContextProject_RDD","full_name":"thervh70/ContextProject_RDD","owner":{"login":"thervh70","id":9721657,"avatar_url":"https://avatars.githubusercontent.com/u/9721657?v=3","gravatar_id":"","url":"https://api.github.com/users/thervh70","html_url":"https://github.com/thervh70","followers_url":"https://api.github.com/users/thervh70/followers","following_url":"https://api.github.com/users/thervh70/following{/other_user}","gists_url":"https://api.github.com/users/thervh70/gists{/gist_id}","starred_url":"https://api.github.com/users/thervh70/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thervh70/subscriptions","organizations_url":"https://api.github.com/users/thervh70/orgs","repos_url":"https://api.github.com/users/thervh70/repos","events_url":"https://api.github.com/users/thervh70/events{/privacy}","received_events_url":"https://api.github.com/users/thervh70/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thervh70/ContextProject_RDD","description":"","fork":false,"url":"https://api.github.com/repos/thervh70/ContextProject_RDD","forks_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/forks","keys_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/teams","hooks_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/hooks","issue_events_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/events{/number}","events_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/events","assignees_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/assignees{/user}","branches_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/branches{/branch}","tags_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/tags","blobs_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/refs{/sha}","trees_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/statuses/{sha}","languages_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/languages","stargazers_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/stargazers","contributors_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/contributors","subscribers_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/subscribers","subscription_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/subscription","commits_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/commits{/sha}","git_commits_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/git/commits{/sha}","comments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/comments{/number}","issue_comment_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/comments{/number}","contents_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/contents/{+path}","compare_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/merges","archive_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/downloads","issues_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues{/number}","pulls_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls{/number}","milestones_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/milestones{/number}","notifications_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/labels{/name}","releases_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/releases{/id}","deployments_url":"https://api.github.com/repos/thervh70/ContextProject_RDD/deployments","created_at":"2016-04-19T09:12:06Z","updated_at":"2016-04-25T14:54:33Z","pushed_at":"2016-05-06T09:44:27Z","git_url":"git://github.com/thervh70/ContextProject_RDD.git","ssh_url":"git@github.com:thervh70/ContextProject_RDD.git","clone_url":"https://github.com/thervh70/ContextProject_RDD.git","svn_url":"https://github.com/thervh70/ContextProject_RDD","homepage":null,"size":2143,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21"},"html":{"href":"https://github.com/thervh70/ContextProject_RDD/pull/21"},"issue":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/21"},"comments":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/thervh70/ContextProject_RDD/statuses/6ae0be8a82a01da43a61644da1f3ffcbc864910f"}}}}