{"action":"created","comment":{"url":"https://api.github.com/repos/medic/medic-sentinel/pulls/comments/80601507","pull_request_review_id":1649246,"id":80601507,"diff_hunk":"@@ -49,3 +65,94 @@ exports['bool expr is ignored (returns true) if not a string or empty'] = functi\n     test.equals(false, transition.isBoolExprFalse({}, ' \\t\\n '));\n     test.done();\n };\n+\n+exports['add_patient trigger creates a new patient'] = function(test) {\n+    var change = { doc: {\n+        form: 'R',\n+        patient_id: '05649',\n+        reported_date: 53,\n+        from: '+555123',\n+        fields: { patient_name: 'jack' }\n+    } };\n+    var view = sinon.stub().callsArgWith(3, null, { rows: [ { doc: { parent: { _id: 'papa' } } } ] });\n+    var db = { medic: { view: view } };\n+    var saveDoc = sinon.stub().callsArgWith(1);\n+    var audit = { saveDoc: saveDoc };\n+    var eventConfig = {\n+        form: 'R',\n+        events: [ { name: 'on_create', trigger: 'add_patient' } ]\n+    };\n+    sinon.stub(config, 'get').returns([ eventConfig ]);\n+    sinon.stub(transition, 'validate').callsArgWith(2);\n+    var getRegistrations = sinon.stub(utils, 'getRegistrations').callsArgWith(1, null, []);\n+    transition.onMatch(change, db, audit, function() {\n+        test.equals(getRegistrations.callCount, 1);\n+        test.equals(getRegistrations.args[0][0].id, '05649');\n+        test.equals(view.callCount, 1);\n+        test.equals(view.args[0][0], 'medic-client');\n+        test.equals(view.args[0][1], 'people_by_phone');\n+        test.deepEqual(view.args[0][2].key, [ '+555123' ]);\n+        test.equals(view.args[0][2].include_docs, true);\n+        test.equals(view.args[0][0], 'medic-client');\n+        test.equals(saveDoc.callCount, 1);\n+        test.equals(saveDoc.args[0][0].name, 'jack');","path":"test/unit/registration.js","position":56,"original_position":56,"commit_id":"d2d76d0f618ea4647d5b1a4e1cd628736837081d","original_commit_id":"d2d76d0f618ea4647d5b1a4e1cd628736837081d","user":{"login":"garethbowen","id":2064938,"avatar_url":"https://avatars.githubusercontent.com/u/2064938?v=3","gravatar_id":"","url":"https://api.github.com/users/garethbowen","html_url":"https://github.com/garethbowen","followers_url":"https://api.github.com/users/garethbowen/followers","following_url":"https://api.github.com/users/garethbowen/following{/other_user}","gists_url":"https://api.github.com/users/garethbowen/gists{/gist_id}","starred_url":"https://api.github.com/users/garethbowen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethbowen/subscriptions","organizations_url":"https://api.github.com/users/garethbowen/orgs","repos_url":"https://api.github.com/users/garethbowen/repos","events_url":"https://api.github.com/users/garethbowen/events{/privacy}","received_events_url":"https://api.github.com/users/garethbowen/received_events","type":"User","site_admin":false},"body":"I don't think I am. The one below checks that a custom field name can be given as a parameter. This one is checking the default name (\"patient_name\")","created_at":"2016-09-27T00:22:55Z","updated_at":"2016-09-27T00:22:55Z","html_url":"https://github.com/medic/medic-sentinel/pull/85#discussion_r80601507","pull_request_url":"https://api.github.com/repos/medic/medic-sentinel/pulls/85","_links":{"self":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/comments/80601507"},"html":{"href":"https://github.com/medic/medic-sentinel/pull/85#discussion_r80601507"},"pull_request":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/85"}}},"pull_request":{"url":"https://api.github.com/repos/medic/medic-sentinel/pulls/85","id":86679325,"html_url":"https://github.com/medic/medic-sentinel/pull/85","diff_url":"https://github.com/medic/medic-sentinel/pull/85.diff","patch_url":"https://github.com/medic/medic-sentinel/pull/85.patch","issue_url":"https://api.github.com/repos/medic/medic-sentinel/issues/85","number":85,"state":"open","locked":false,"title":"Patient centric sms workflow. Issue: medic/medic-webapp#2700","user":{"login":"garethbowen","id":2064938,"avatar_url":"https://avatars.githubusercontent.com/u/2064938?v=3","gravatar_id":"","url":"https://api.github.com/users/garethbowen","html_url":"https://github.com/garethbowen","followers_url":"https://api.github.com/users/garethbowen/followers","following_url":"https://api.github.com/users/garethbowen/following{/other_user}","gists_url":"https://api.github.com/users/garethbowen/gists{/gist_id}","starred_url":"https://api.github.com/users/garethbowen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garethbowen/subscriptions","organizations_url":"https://api.github.com/users/garethbowen/orgs","repos_url":"https://api.github.com/users/garethbowen/repos","events_url":"https://api.github.com/users/garethbowen/events{/privacy}","received_events_url":"https://api.github.com/users/garethbowen/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-26T04:11:04Z","updated_at":"2016-09-27T00:22:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3da35a5bf3574fa08f2cc896d4b1a6fad2b330ef","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/medic/medic-sentinel/pulls/85/commits","review_comments_url":"https://api.github.com/repos/medic/medic-sentinel/pulls/85/comments","review_comment_url":"https://api.github.com/repos/medic/medic-sentinel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/medic/medic-sentinel/issues/85/comments","statuses_url":"https://api.github.com/repos/medic/medic-sentinel/statuses/d2d76d0f618ea4647d5b1a4e1cd628736837081d","head":{"label":"medic:2700-patient-centric-sms","ref":"2700-patient-centric-sms","sha":"d2d76d0f618ea4647d5b1a4e1cd628736837081d","user":{"login":"medic","id":474424,"avatar_url":"https://avatars.githubusercontent.com/u/474424?v=3","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"repo":{"id":11725950,"name":"medic-sentinel","full_name":"medic/medic-sentinel","owner":{"login":"medic","id":474424,"avatar_url":"https://avatars.githubusercontent.com/u/474424?v=3","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/medic/medic-sentinel","description":"Node.js worker for medic-webapp","fork":false,"url":"https://api.github.com/repos/medic/medic-sentinel","forks_url":"https://api.github.com/repos/medic/medic-sentinel/forks","keys_url":"https://api.github.com/repos/medic/medic-sentinel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medic/medic-sentinel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medic/medic-sentinel/teams","hooks_url":"https://api.github.com/repos/medic/medic-sentinel/hooks","issue_events_url":"https://api.github.com/repos/medic/medic-sentinel/issues/events{/number}","events_url":"https://api.github.com/repos/medic/medic-sentinel/events","assignees_url":"https://api.github.com/repos/medic/medic-sentinel/assignees{/user}","branches_url":"https://api.github.com/repos/medic/medic-sentinel/branches{/branch}","tags_url":"https://api.github.com/repos/medic/medic-sentinel/tags","blobs_url":"https://api.github.com/repos/medic/medic-sentinel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medic/medic-sentinel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medic/medic-sentinel/git/refs{/sha}","trees_url":"https://api.github.com/repos/medic/medic-sentinel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medic/medic-sentinel/statuses/{sha}","languages_url":"https://api.github.com/repos/medic/medic-sentinel/languages","stargazers_url":"https://api.github.com/repos/medic/medic-sentinel/stargazers","contributors_url":"https://api.github.com/repos/medic/medic-sentinel/contributors","subscribers_url":"https://api.github.com/repos/medic/medic-sentinel/subscribers","subscription_url":"https://api.github.com/repos/medic/medic-sentinel/subscription","commits_url":"https://api.github.com/repos/medic/medic-sentinel/commits{/sha}","git_commits_url":"https://api.github.com/repos/medic/medic-sentinel/git/commits{/sha}","comments_url":"https://api.github.com/repos/medic/medic-sentinel/comments{/number}","issue_comment_url":"https://api.github.com/repos/medic/medic-sentinel/issues/comments{/number}","contents_url":"https://api.github.com/repos/medic/medic-sentinel/contents/{+path}","compare_url":"https://api.github.com/repos/medic/medic-sentinel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medic/medic-sentinel/merges","archive_url":"https://api.github.com/repos/medic/medic-sentinel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medic/medic-sentinel/downloads","issues_url":"https://api.github.com/repos/medic/medic-sentinel/issues{/number}","pulls_url":"https://api.github.com/repos/medic/medic-sentinel/pulls{/number}","milestones_url":"https://api.github.com/repos/medic/medic-sentinel/milestones{/number}","notifications_url":"https://api.github.com/repos/medic/medic-sentinel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medic/medic-sentinel/labels{/name}","releases_url":"https://api.github.com/repos/medic/medic-sentinel/releases{/id}","deployments_url":"https://api.github.com/repos/medic/medic-sentinel/deployments","created_at":"2013-07-28T21:14:52Z","updated_at":"2016-02-16T22:36:52Z","pushed_at":"2016-09-26T04:11:04Z","git_url":"git://github.com/medic/medic-sentinel.git","ssh_url":"git@github.com:medic/medic-sentinel.git","clone_url":"https://github.com/medic/medic-sentinel.git","svn_url":"https://github.com/medic/medic-sentinel","homepage":"","size":2532,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":1,"default_branch":"master"}},"base":{"label":"medic:master","ref":"master","sha":"227f1a870e555b1cfeb85cd625e5c8468c6a84f7","user":{"login":"medic","id":474424,"avatar_url":"https://avatars.githubusercontent.com/u/474424?v=3","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"repo":{"id":11725950,"name":"medic-sentinel","full_name":"medic/medic-sentinel","owner":{"login":"medic","id":474424,"avatar_url":"https://avatars.githubusercontent.com/u/474424?v=3","gravatar_id":"","url":"https://api.github.com/users/medic","html_url":"https://github.com/medic","followers_url":"https://api.github.com/users/medic/followers","following_url":"https://api.github.com/users/medic/following{/other_user}","gists_url":"https://api.github.com/users/medic/gists{/gist_id}","starred_url":"https://api.github.com/users/medic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medic/subscriptions","organizations_url":"https://api.github.com/users/medic/orgs","repos_url":"https://api.github.com/users/medic/repos","events_url":"https://api.github.com/users/medic/events{/privacy}","received_events_url":"https://api.github.com/users/medic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/medic/medic-sentinel","description":"Node.js worker for medic-webapp","fork":false,"url":"https://api.github.com/repos/medic/medic-sentinel","forks_url":"https://api.github.com/repos/medic/medic-sentinel/forks","keys_url":"https://api.github.com/repos/medic/medic-sentinel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medic/medic-sentinel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medic/medic-sentinel/teams","hooks_url":"https://api.github.com/repos/medic/medic-sentinel/hooks","issue_events_url":"https://api.github.com/repos/medic/medic-sentinel/issues/events{/number}","events_url":"https://api.github.com/repos/medic/medic-sentinel/events","assignees_url":"https://api.github.com/repos/medic/medic-sentinel/assignees{/user}","branches_url":"https://api.github.com/repos/medic/medic-sentinel/branches{/branch}","tags_url":"https://api.github.com/repos/medic/medic-sentinel/tags","blobs_url":"https://api.github.com/repos/medic/medic-sentinel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medic/medic-sentinel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medic/medic-sentinel/git/refs{/sha}","trees_url":"https://api.github.com/repos/medic/medic-sentinel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medic/medic-sentinel/statuses/{sha}","languages_url":"https://api.github.com/repos/medic/medic-sentinel/languages","stargazers_url":"https://api.github.com/repos/medic/medic-sentinel/stargazers","contributors_url":"https://api.github.com/repos/medic/medic-sentinel/contributors","subscribers_url":"https://api.github.com/repos/medic/medic-sentinel/subscribers","subscription_url":"https://api.github.com/repos/medic/medic-sentinel/subscription","commits_url":"https://api.github.com/repos/medic/medic-sentinel/commits{/sha}","git_commits_url":"https://api.github.com/repos/medic/medic-sentinel/git/commits{/sha}","comments_url":"https://api.github.com/repos/medic/medic-sentinel/comments{/number}","issue_comment_url":"https://api.github.com/repos/medic/medic-sentinel/issues/comments{/number}","contents_url":"https://api.github.com/repos/medic/medic-sentinel/contents/{+path}","compare_url":"https://api.github.com/repos/medic/medic-sentinel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medic/medic-sentinel/merges","archive_url":"https://api.github.com/repos/medic/medic-sentinel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medic/medic-sentinel/downloads","issues_url":"https://api.github.com/repos/medic/medic-sentinel/issues{/number}","pulls_url":"https://api.github.com/repos/medic/medic-sentinel/pulls{/number}","milestones_url":"https://api.github.com/repos/medic/medic-sentinel/milestones{/number}","notifications_url":"https://api.github.com/repos/medic/medic-sentinel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medic/medic-sentinel/labels{/name}","releases_url":"https://api.github.com/repos/medic/medic-sentinel/releases{/id}","deployments_url":"https://api.github.com/repos/medic/medic-sentinel/deployments","created_at":"2013-07-28T21:14:52Z","updated_at":"2016-02-16T22:36:52Z","pushed_at":"2016-09-26T04:11:04Z","git_url":"git://github.com/medic/medic-sentinel.git","ssh_url":"git@github.com:medic/medic-sentinel.git","clone_url":"https://github.com/medic/medic-sentinel.git","svn_url":"https://github.com/medic/medic-sentinel","homepage":"","size":2532,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":10,"forks":2,"open_issues":10,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/85"},"html":{"href":"https://github.com/medic/medic-sentinel/pull/85"},"issue":{"href":"https://api.github.com/repos/medic/medic-sentinel/issues/85"},"comments":{"href":"https://api.github.com/repos/medic/medic-sentinel/issues/85/comments"},"review_comments":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/85/comments"},"review_comment":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/medic/medic-sentinel/pulls/85/commits"},"statuses":{"href":"https://api.github.com/repos/medic/medic-sentinel/statuses/d2d76d0f618ea4647d5b1a4e1cd628736837081d"}}}}
{"actor":{"display_login":"garethbowen"}}