{"action":"created","comment":{"url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/comments/34496418","id":34496418,"diff_hunk":"@@ -1,35 +1,303 @@\n var chai = require('chai');\n var expect = chai.expect;\n var loanStore;\n+var scenarioStore;\n var $;\n var sinon = require('sinon');\n var mortgageCalculations = require('../../src/static/js/modules/loan-comparison/mortgage-calculations.js');\n \n+var api;\n+\n \n describe('Loan store tests', function() {\n     before(function () {\n         $ = require('jquery');\n         loanStore = require('../../src/static/js/modules/loan-comparison/stores/loan-store.js');\n+        scenarioStore = require('../../src/static/js/modules/loan-comparison/stores/scenario-store.js');\n+        api = require('../../src/static/js/modules/loan-comparison/api.js');\n     });\n     \n+    describe('init', function() {\n+        it('should reset all loans when init', function() {\n+            var initStub = sinon.stub(loanStore, 'resetAllLoans');\n+\n+            loanStore.init();\n+\n+            sinon.assert.calledOnce(loanStore.resetAllLoans);\n+            \n+            loanStore.resetAllLoans.restore();\n+        });\n+    });\n+\n     describe('reset all loans', function() {\n+        it('should reset all loans when there are no loans', function() {\n+\n+            var getScenarioStub = sinon.stub(scenarioStore, 'getScenario');\n+            var updateDPConstStub = sinon.stub(loanStore, 'updateDownpaymentConstant');\n+            var resetLoanStub = sinon.stub(loanStore, 'resetLoan');","path":"test/js/loan_store_test.js","position":37,"original_position":37,"commit_id":"e010d12232b1237cd7790267af0d522cf08b2695","original_commit_id":"e010d12232b1237cd7790267af0d522cf08b2695","user":{"login":"amymok","id":2673022,"avatar_url":"https://avatars.githubusercontent.com/u/2673022?v=3","gravatar_id":"","url":"https://api.github.com/users/amymok","html_url":"https://github.com/amymok","followers_url":"https://api.github.com/users/amymok/followers","following_url":"https://api.github.com/users/amymok/following{/other_user}","gists_url":"https://api.github.com/users/amymok/gists{/gist_id}","starred_url":"https://api.github.com/users/amymok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amymok/subscriptions","organizations_url":"https://api.github.com/users/amymok/orgs","repos_url":"https://api.github.com/users/amymok/repos","events_url":"https://api.github.com/users/amymok/events{/privacy}","received_events_url":"https://api.github.com/users/amymok/received_events","type":"User","site_admin":false},"body":"I didn't look at spy, but now that I did, I think I want to continue to use a stub because I don't want to actually run those functions in this unit test since my inputs may not be what exactly they expect which may result in errors.  And also I don't want any side effect to affect anything.\r\n\r\nI may be diff if I want to do something more like an integration test.","created_at":"2015-07-13T18:41:42Z","updated_at":"2015-07-13T18:41:42Z","html_url":"https://github.com/cfpb/owning-a-home/pull/507#discussion_r34496418","pull_request_url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507","_links":{"self":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/comments/34496418"},"html":{"href":"https://github.com/cfpb/owning-a-home/pull/507#discussion_r34496418"},"pull_request":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507"}}},"pull_request":{"url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507","id":39616610,"html_url":"https://github.com/cfpb/owning-a-home/pull/507","diff_url":"https://github.com/cfpb/owning-a-home/pull/507.diff","patch_url":"https://github.com/cfpb/owning-a-home/pull/507.patch","issue_url":"https://api.github.com/repos/cfpb/owning-a-home/issues/507","number":507,"state":"open","locked":false,"title":"More auto test for loanstore","user":{"login":"amymok","id":2673022,"avatar_url":"https://avatars.githubusercontent.com/u/2673022?v=3","gravatar_id":"","url":"https://api.github.com/users/amymok","html_url":"https://github.com/amymok","followers_url":"https://api.github.com/users/amymok/followers","following_url":"https://api.github.com/users/amymok/following{/other_user}","gists_url":"https://api.github.com/users/amymok/gists{/gist_id}","starred_url":"https://api.github.com/users/amymok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amymok/subscriptions","organizations_url":"https://api.github.com/users/amymok/orgs","repos_url":"https://api.github.com/users/amymok/repos","events_url":"https://api.github.com/users/amymok/events{/privacy}","received_events_url":"https://api.github.com/users/amymok/received_events","type":"User","site_admin":false},"body":"### Additions\r\n* Add a lot of unit tests for loanstore\r\n  * Mostly for resetLoans and updateLoans related functions\r\n\r\n### Reviews\r\n@virginiacc @cfarm ","created_at":"2015-07-09T19:01:20Z","updated_at":"2015-07-13T18:41:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"568536688a01f2b99645c1b73d7ae2c91b2e1486","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507/commits","review_comments_url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507/comments","review_comment_url":"https://api.github.com/repos/cfpb/owning-a-home/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/owning-a-home/issues/507/comments","statuses_url":"https://api.github.com/repos/cfpb/owning-a-home/statuses/e010d12232b1237cd7790267af0d522cf08b2695","head":{"label":"amymok:more-auto-test-loanstore","ref":"more-auto-test-loanstore","sha":"e010d12232b1237cd7790267af0d522cf08b2695","user":{"login":"amymok","id":2673022,"avatar_url":"https://avatars.githubusercontent.com/u/2673022?v=3","gravatar_id":"","url":"https://api.github.com/users/amymok","html_url":"https://github.com/amymok","followers_url":"https://api.github.com/users/amymok/followers","following_url":"https://api.github.com/users/amymok/following{/other_user}","gists_url":"https://api.github.com/users/amymok/gists{/gist_id}","starred_url":"https://api.github.com/users/amymok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amymok/subscriptions","organizations_url":"https://api.github.com/users/amymok/orgs","repos_url":"https://api.github.com/users/amymok/repos","events_url":"https://api.github.com/users/amymok/events{/privacy}","received_events_url":"https://api.github.com/users/amymok/received_events","type":"User","site_admin":false},"repo":{"id":33629105,"name":"owning-a-home","full_name":"amymok/owning-a-home","owner":{"login":"amymok","id":2673022,"avatar_url":"https://avatars.githubusercontent.com/u/2673022?v=3","gravatar_id":"","url":"https://api.github.com/users/amymok","html_url":"https://github.com/amymok","followers_url":"https://api.github.com/users/amymok/followers","following_url":"https://api.github.com/users/amymok/following{/other_user}","gists_url":"https://api.github.com/users/amymok/gists{/gist_id}","starred_url":"https://api.github.com/users/amymok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amymok/subscriptions","organizations_url":"https://api.github.com/users/amymok/orgs","repos_url":"https://api.github.com/users/amymok/repos","events_url":"https://api.github.com/users/amymok/events{/privacy}","received_events_url":"https://api.github.com/users/amymok/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amymok/owning-a-home","description":"Unbiased mortgage rate comparison tool for homebuyers.","fork":true,"url":"https://api.github.com/repos/amymok/owning-a-home","forks_url":"https://api.github.com/repos/amymok/owning-a-home/forks","keys_url":"https://api.github.com/repos/amymok/owning-a-home/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amymok/owning-a-home/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amymok/owning-a-home/teams","hooks_url":"https://api.github.com/repos/amymok/owning-a-home/hooks","issue_events_url":"https://api.github.com/repos/amymok/owning-a-home/issues/events{/number}","events_url":"https://api.github.com/repos/amymok/owning-a-home/events","assignees_url":"https://api.github.com/repos/amymok/owning-a-home/assignees{/user}","branches_url":"https://api.github.com/repos/amymok/owning-a-home/branches{/branch}","tags_url":"https://api.github.com/repos/amymok/owning-a-home/tags","blobs_url":"https://api.github.com/repos/amymok/owning-a-home/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amymok/owning-a-home/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amymok/owning-a-home/git/refs{/sha}","trees_url":"https://api.github.com/repos/amymok/owning-a-home/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amymok/owning-a-home/statuses/{sha}","languages_url":"https://api.github.com/repos/amymok/owning-a-home/languages","stargazers_url":"https://api.github.com/repos/amymok/owning-a-home/stargazers","contributors_url":"https://api.github.com/repos/amymok/owning-a-home/contributors","subscribers_url":"https://api.github.com/repos/amymok/owning-a-home/subscribers","subscription_url":"https://api.github.com/repos/amymok/owning-a-home/subscription","commits_url":"https://api.github.com/repos/amymok/owning-a-home/commits{/sha}","git_commits_url":"https://api.github.com/repos/amymok/owning-a-home/git/commits{/sha}","comments_url":"https://api.github.com/repos/amymok/owning-a-home/comments{/number}","issue_comment_url":"https://api.github.com/repos/amymok/owning-a-home/issues/comments{/number}","contents_url":"https://api.github.com/repos/amymok/owning-a-home/contents/{+path}","compare_url":"https://api.github.com/repos/amymok/owning-a-home/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amymok/owning-a-home/merges","archive_url":"https://api.github.com/repos/amymok/owning-a-home/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amymok/owning-a-home/downloads","issues_url":"https://api.github.com/repos/amymok/owning-a-home/issues{/number}","pulls_url":"https://api.github.com/repos/amymok/owning-a-home/pulls{/number}","milestones_url":"https://api.github.com/repos/amymok/owning-a-home/milestones{/number}","notifications_url":"https://api.github.com/repos/amymok/owning-a-home/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amymok/owning-a-home/labels{/name}","releases_url":"https://api.github.com/repos/amymok/owning-a-home/releases{/id}","created_at":"2015-04-08T19:59:57Z","updated_at":"2015-05-22T16:08:15Z","pushed_at":"2015-07-09T18:58:58Z","git_url":"git://github.com/amymok/owning-a-home.git","ssh_url":"git@github.com:amymok/owning-a-home.git","clone_url":"https://github.com/amymok/owning-a-home.git","svn_url":"https://github.com/amymok/owning-a-home","homepage":"","size":11689,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"cfpb:master","ref":"master","sha":"8c0c83889325c93740242e08112ba191718cfe2c","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":15999442,"name":"owning-a-home","full_name":"cfpb/owning-a-home","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/owning-a-home","description":"Unbiased mortgage rate comparison tool for homebuyers.","fork":false,"url":"https://api.github.com/repos/cfpb/owning-a-home","forks_url":"https://api.github.com/repos/cfpb/owning-a-home/forks","keys_url":"https://api.github.com/repos/cfpb/owning-a-home/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/owning-a-home/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/owning-a-home/teams","hooks_url":"https://api.github.com/repos/cfpb/owning-a-home/hooks","issue_events_url":"https://api.github.com/repos/cfpb/owning-a-home/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/owning-a-home/events","assignees_url":"https://api.github.com/repos/cfpb/owning-a-home/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/owning-a-home/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/owning-a-home/tags","blobs_url":"https://api.github.com/repos/cfpb/owning-a-home/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/owning-a-home/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/owning-a-home/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/owning-a-home/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/owning-a-home/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/owning-a-home/languages","stargazers_url":"https://api.github.com/repos/cfpb/owning-a-home/stargazers","contributors_url":"https://api.github.com/repos/cfpb/owning-a-home/contributors","subscribers_url":"https://api.github.com/repos/cfpb/owning-a-home/subscribers","subscription_url":"https://api.github.com/repos/cfpb/owning-a-home/subscription","commits_url":"https://api.github.com/repos/cfpb/owning-a-home/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/owning-a-home/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/owning-a-home/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/owning-a-home/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/owning-a-home/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/owning-a-home/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/owning-a-home/merges","archive_url":"https://api.github.com/repos/cfpb/owning-a-home/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/owning-a-home/downloads","issues_url":"https://api.github.com/repos/cfpb/owning-a-home/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/owning-a-home/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/owning-a-home/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/owning-a-home/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/owning-a-home/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/owning-a-home/releases{/id}","created_at":"2014-01-17T12:42:59Z","updated_at":"2015-07-11T15:52:44Z","pushed_at":"2015-07-13T15:30:45Z","git_url":"git://github.com/cfpb/owning-a-home.git","ssh_url":"git@github.com:cfpb/owning-a-home.git","clone_url":"https://github.com/cfpb/owning-a-home.git","svn_url":"https://github.com/cfpb/owning-a-home","homepage":"http://consumerfinance.gov/owning-a-home","size":23238,"stargazers_count":30,"watchers_count":30,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":36,"mirror_url":null,"open_issues_count":36,"forks":36,"open_issues":36,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507"},"html":{"href":"https://github.com/cfpb/owning-a-home/pull/507"},"issue":{"href":"https://api.github.com/repos/cfpb/owning-a-home/issues/507"},"comments":{"href":"https://api.github.com/repos/cfpb/owning-a-home/issues/507/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/owning-a-home/pulls/507/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/owning-a-home/statuses/e010d12232b1237cd7790267af0d522cf08b2695"}}}}