{"action":"created","comment":{"url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/comments/35945861","id":35945861,"diff_hunk":"@@ -0,0 +1,95 @@\n+import chai from 'chai';\n+import chaiAsPromised from 'chai-as-promised';\n+import 'mochawait';\n+//import ADB from 'appium-adb';\n+//import { withMocks } from 'appium-test-support';\n+import { SelendroidDriver } from '../../lib/driver.js';\n+import sinon from 'sinon';\n+import path from 'path';\n+//import { BaseDriver } from 'appium-base-driver';\n+\n+chai.should();\n+chai.use(chaiAsPromised);\n+\n+describe('driver.js', () => {\n+//  let adb = new ADB();\n+\n+\n+  describe('constructor', () => {\n+    it('calls BaseDriver constructor with opts', () => {\n+      let driver = new SelendroidDriver({foo: 'bar'});\n+      driver.should.exist;\n+      driver.opts.foo.should.equal('bar');\n+    });\n+  });\n+\n+  describe('createSession', () => {\n+    it('should throw an error if app can not be found', async () => {\n+      let driver = new SelendroidDriver({}, false);\n+      await driver.createSession({app: 'foo.apk'}).should.be.rejectedWith('app apk');\n+    });\n+\n+    it('should set sessionId', async () => {\n+      let driver = new SelendroidDriver({}, false);\n+      sinon.mock(driver).expects('checkAppPresent')\n+                        .once()\n+                        .returns(Promise.resolve());\n+      sinon.mock(driver).expects('startSelendroidSession')\n+                        .once()\n+                        .returns(Promise.resolve());\n+      await driver.createSession({cap: 'foo'});\n+\n+      driver.sessionId.should.exist;\n+      driver.caps.cap.should.equal('foo');\n+    });\n+  });\n+\n+  describe('checkAppPresent', async () => {\n+    it('should resolve if app present', async () => {\n+      let driver = new SelendroidDriver({}, false);\n+      sinon.mock(driver).expects('checkAppPresent')\n+                        .returns(Promise.resolve());\n+      sinon.mock(driver).expects('startSelendroidSession')\n+                        .returns(Promise.resolve());\n+\n+      await driver.createSession({app: path.resolve('.')});\n+\n+      driver.checkAppPresent.restore();","path":"test/unit/driver-specs.js","position":57,"original_position":57,"commit_id":"a66ce64f4dd0a36fc79e4d5394bdd85a1cdb0034","original_commit_id":"a66ce64f4dd0a36fc79e4d5394bdd85a1cdb0034","user":{"login":"jlipps","id":605053,"avatar_url":"https://avatars.githubusercontent.com/u/605053?v=3","gravatar_id":"","url":"https://api.github.com/users/jlipps","html_url":"https://github.com/jlipps","followers_url":"https://api.github.com/users/jlipps/followers","following_url":"https://api.github.com/users/jlipps/following{/other_user}","gists_url":"https://api.github.com/users/jlipps/gists{/gist_id}","starred_url":"https://api.github.com/users/jlipps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlipps/subscriptions","organizations_url":"https://api.github.com/users/jlipps/orgs","repos_url":"https://api.github.com/users/jlipps/repos","events_url":"https://api.github.com/users/jlipps/events{/privacy}","received_events_url":"https://api.github.com/users/jlipps/received_events","type":"User","site_admin":false},"body":"`withMocks` doesn't restore automatically?","created_at":"2015-07-31T04:27:13Z","updated_at":"2015-07-31T04:27:13Z","html_url":"https://github.com/appium/appium-selendroid-driver/pull/5#discussion_r35945861","pull_request_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/comments/35945861"},"html":{"href":"https://github.com/appium/appium-selendroid-driver/pull/5#discussion_r35945861"},"pull_request":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5","id":41294778,"html_url":"https://github.com/appium/appium-selendroid-driver/pull/5","diff_url":"https://github.com/appium/appium-selendroid-driver/pull/5.diff","patch_url":"https://github.com/appium/appium-selendroid-driver/pull/5.patch","issue_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/5","number":5,"state":"open","locked":false,"title":"Mj","user":{"login":"Jonahss","id":1521841,"avatar_url":"https://avatars.githubusercontent.com/u/1521841?v=3","gravatar_id":"","url":"https://api.github.com/users/Jonahss","html_url":"https://github.com/Jonahss","followers_url":"https://api.github.com/users/Jonahss/followers","following_url":"https://api.github.com/users/Jonahss/following{/other_user}","gists_url":"https://api.github.com/users/Jonahss/gists{/gist_id}","starred_url":"https://api.github.com/users/Jonahss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jonahss/subscriptions","organizations_url":"https://api.github.com/users/Jonahss/orgs","repos_url":"https://api.github.com/users/Jonahss/repos","events_url":"https://api.github.com/users/Jonahss/events{/privacy}","received_events_url":"https://api.github.com/users/Jonahss/received_events","type":"User","site_admin":false},"body":"Moved android-helpers into the android-driver repo.\r\n\r\nAdded a couple unit tests.\r\n\r\n@jlipps do you want e2e tests too? hard to test some of these functions as they would turn into 100% mocks.","created_at":"2015-07-30T23:50:50Z","updated_at":"2015-07-31T04:27:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d77aea0504dc325ea1b540074ff2a1449b6077ec","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5/commits","review_comments_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5/comments","review_comment_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/comments{/number}","comments_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/5/comments","statuses_url":"https://api.github.com/repos/appium/appium-selendroid-driver/statuses/a66ce64f4dd0a36fc79e4d5394bdd85a1cdb0034","head":{"label":"appium:MJ","ref":"MJ","sha":"a66ce64f4dd0a36fc79e4d5394bdd85a1cdb0034","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":37222526,"name":"appium-selendroid-driver","full_name":"appium/appium-selendroid-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-selendroid-driver","description":"Appium's Selendroid integration","fork":false,"url":"https://api.github.com/repos/appium/appium-selendroid-driver","forks_url":"https://api.github.com/repos/appium/appium-selendroid-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-selendroid-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-selendroid-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-selendroid-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-selendroid-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-selendroid-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-selendroid-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-selendroid-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-selendroid-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-selendroid-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-selendroid-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-selendroid-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-selendroid-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-selendroid-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-selendroid-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-selendroid-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-selendroid-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-selendroid-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-selendroid-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-selendroid-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-selendroid-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-selendroid-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-selendroid-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-selendroid-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-selendroid-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-selendroid-driver/releases{/id}","created_at":"2015-06-10T21:03:17Z","updated_at":"2015-06-11T22:55:25Z","pushed_at":"2015-07-30T23:50:50Z","git_url":"git://github.com/appium/appium-selendroid-driver.git","ssh_url":"git@github.com:appium/appium-selendroid-driver.git","clone_url":"https://github.com/appium/appium-selendroid-driver.git","svn_url":"https://github.com/appium/appium-selendroid-driver","homepage":null,"size":1129,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"appium:master","ref":"master","sha":"f446e77603fff885d909fa53d49f6eb79ae8fde5","user":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"repo":{"id":37222526,"name":"appium-selendroid-driver","full_name":"appium/appium-selendroid-driver","owner":{"login":"appium","id":3221291,"avatar_url":"https://avatars.githubusercontent.com/u/3221291?v=3","gravatar_id":"","url":"https://api.github.com/users/appium","html_url":"https://github.com/appium","followers_url":"https://api.github.com/users/appium/followers","following_url":"https://api.github.com/users/appium/following{/other_user}","gists_url":"https://api.github.com/users/appium/gists{/gist_id}","starred_url":"https://api.github.com/users/appium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appium/subscriptions","organizations_url":"https://api.github.com/users/appium/orgs","repos_url":"https://api.github.com/users/appium/repos","events_url":"https://api.github.com/users/appium/events{/privacy}","received_events_url":"https://api.github.com/users/appium/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/appium/appium-selendroid-driver","description":"Appium's Selendroid integration","fork":false,"url":"https://api.github.com/repos/appium/appium-selendroid-driver","forks_url":"https://api.github.com/repos/appium/appium-selendroid-driver/forks","keys_url":"https://api.github.com/repos/appium/appium-selendroid-driver/keys{/key_id}","collaborators_url":"https://api.github.com/repos/appium/appium-selendroid-driver/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/appium/appium-selendroid-driver/teams","hooks_url":"https://api.github.com/repos/appium/appium-selendroid-driver/hooks","issue_events_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/events{/number}","events_url":"https://api.github.com/repos/appium/appium-selendroid-driver/events","assignees_url":"https://api.github.com/repos/appium/appium-selendroid-driver/assignees{/user}","branches_url":"https://api.github.com/repos/appium/appium-selendroid-driver/branches{/branch}","tags_url":"https://api.github.com/repos/appium/appium-selendroid-driver/tags","blobs_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/refs{/sha}","trees_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/trees{/sha}","statuses_url":"https://api.github.com/repos/appium/appium-selendroid-driver/statuses/{sha}","languages_url":"https://api.github.com/repos/appium/appium-selendroid-driver/languages","stargazers_url":"https://api.github.com/repos/appium/appium-selendroid-driver/stargazers","contributors_url":"https://api.github.com/repos/appium/appium-selendroid-driver/contributors","subscribers_url":"https://api.github.com/repos/appium/appium-selendroid-driver/subscribers","subscription_url":"https://api.github.com/repos/appium/appium-selendroid-driver/subscription","commits_url":"https://api.github.com/repos/appium/appium-selendroid-driver/commits{/sha}","git_commits_url":"https://api.github.com/repos/appium/appium-selendroid-driver/git/commits{/sha}","comments_url":"https://api.github.com/repos/appium/appium-selendroid-driver/comments{/number}","issue_comment_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/comments{/number}","contents_url":"https://api.github.com/repos/appium/appium-selendroid-driver/contents/{+path}","compare_url":"https://api.github.com/repos/appium/appium-selendroid-driver/compare/{base}...{head}","merges_url":"https://api.github.com/repos/appium/appium-selendroid-driver/merges","archive_url":"https://api.github.com/repos/appium/appium-selendroid-driver/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/appium/appium-selendroid-driver/downloads","issues_url":"https://api.github.com/repos/appium/appium-selendroid-driver/issues{/number}","pulls_url":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls{/number}","milestones_url":"https://api.github.com/repos/appium/appium-selendroid-driver/milestones{/number}","notifications_url":"https://api.github.com/repos/appium/appium-selendroid-driver/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/appium/appium-selendroid-driver/labels{/name}","releases_url":"https://api.github.com/repos/appium/appium-selendroid-driver/releases{/id}","created_at":"2015-06-10T21:03:17Z","updated_at":"2015-06-11T22:55:25Z","pushed_at":"2015-07-30T23:50:50Z","git_url":"git://github.com/appium/appium-selendroid-driver.git","ssh_url":"git@github.com:appium/appium-selendroid-driver.git","clone_url":"https://github.com/appium/appium-selendroid-driver.git","svn_url":"https://github.com/appium/appium-selendroid-driver","homepage":null,"size":1129,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5"},"html":{"href":"https://github.com/appium/appium-selendroid-driver/pull/5"},"issue":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/5"},"comments":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/appium/appium-selendroid-driver/statuses/a66ce64f4dd0a36fc79e4d5394bdd85a1cdb0034"}}}}