{"action":"created","comment":{"url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/comments/107771162","pull_request_review_id":28743675,"id":107771162,"diff_hunk":"@@ -1,12 +1,98 @@\n+import Ember from 'ember';\n import { moduleFor, test } from 'ember-qunit';\n+import FactoryGuy, { manualSetup } from 'ember-data-factory-guy';\n+\n \n moduleFor('controller:content', 'Unit | Controller | content', {\n-  // Specify the other units that are required for this test.\n-  needs: ['service:metrics', 'service:theme']\n+    needs: ['service:metrics', 'service:theme', 'model:file', 'model:preprint',\n+            'model:preprint-provider', 'model:node', 'model:license',\n+            'model:user', 'model:citation', 'model:draft-registration',\n+            'model:contributor', 'model:comment', 'model:institution',\n+            'model:registration', 'model:file-provider', 'model:log',\n+            'model:node-link', 'model:wiki'],\n+    beforeEach: function() {\n+        manualSetup(this.container);\n+    }\n });\n \n // Replace this with your real tests.\n test('it exists', function(assert) {\n-  let controller = this.subject();\n-  assert.ok(controller);\n+    let controller = this.subject();\n+    assert.ok(controller);\n+});\n+\n+test('fullLicenseText computed property', function(assert) {\n+    let ctrl = this.subject();\n+    let preprint = FactoryGuy.make('preprint');\n+    let license = preprint.get('license');\n+    ctrl.set('model', preprint);\n+    license.set('text', 'On {{year}}, for {{copyrightHolders}}');\n+\n+    preprint.set('licenseRecord',  {\n+        year: '2001',\n+        copyright_holders: ['Henrique', 'Someone Else']\n+    });\n+    ctrl.notifyPropertyChange('model.license');\n+    assert.equal(ctrl.get('fullLicenseText'), 'On 2001, for Henrique,Someone Else');\n+\n+    preprint.set('licenseRecord',  {\n+        year: '',\n+        copyright_holders: []\n+    });\n+    ctrl.notifyPropertyChange('model.license');\n+    assert.equal(ctrl.get('fullLicenseText'), 'On , for ');\n+\n+    preprint.set('licenseRecord',  {\n+        year: '{{year}}',\n+        copyright_holders: ['{{copyrightHolders}}']\n+    });\n+    ctrl.notifyPropertyChange('model.license');\n+    assert.equal(ctrl.get('fullLicenseText'), 'On {{year}}, for {{copyrightHolders}}');\n+});\n+\n+test('useShortenedDescription computed property', function(assert) {\n+    let ctrl = this.subject();\n+    let node = FactoryGuy.make('node');\n+    ctrl.set('node', node);\n+    Ember.run(() => {\n+        node.set('description', 'string'.repeat(100).slice(0, 351));\n+        ctrl.notifyPropertyChange('node.description');\n+        assert.ok(ctrl.get('useShortenedDescription'));\n+\n+        node.set('description', 'string'.repeat(100).slice(0, 350));\n+        ctrl.notifyPropertyChange('node.description');\n+        assert.ok(!ctrl.get('useShortenedDescription'));\n+\n+        node.set('description', 'string'.repeat(100).slice(0, 349));\n+        ctrl.notifyPropertyChange('node.description');\n+        assert.ok(!ctrl.get('useShortenedDescription'));\n+    });\n+});\n+\n+test('description computed property', function(assert) {\n+    Ember.run(() => {\n+        let ctrl = this.subject();\n+        let node = FactoryGuy.make('node');\n+        ctrl.set('node', node);\n+        ctrl.set('expandedAbstract', false);\n+\n+        //Test cut at 350 characters\n+        let description = 'string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string string str';\n+        let notExpanded = description.slice(0, 350);\n+        node.set('description', description);\n+        ctrl.notifyPropertyChange('description');\n+        assert.equal(ctrl.get('description'), notExpanded.trim());\n+\n+        //Test cut at less than 350 characters to not cut in middle of word\n+        description = 'string stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring';\n+        notExpanded = 'string ';\n+        node.set('description', description);\n+        ctrl.notifyPropertyChange('description');\n+        assert.equal(ctrl.get('description'), notExpanded.trim());\n+\n+        //Test less than 350 doesn't use description (uses node.description)\n+\n+        ctrl.set('expandedAbstract', true);\n+        // expandedAbstract logic has been moved to the template, making the expanded tests unnescessary here.","path":"tests/unit/controllers/content-test.js","position":100,"original_position":100,"commit_id":"93b096d43fab80498e220ca6437761299c53663f","original_commit_id":"93b096d43fab80498e220ca6437761299c53663f","user":{"login":"abought","id":2957073,"avatar_url":"https://avatars1.githubusercontent.com/u/2957073?v=3","gravatar_id":"","url":"https://api.github.com/users/abought","html_url":"https://github.com/abought","followers_url":"https://api.github.com/users/abought/followers","following_url":"https://api.github.com/users/abought/following{/other_user}","gists_url":"https://api.github.com/users/abought/gists{/gist_id}","starred_url":"https://api.github.com/users/abought/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abought/subscriptions","organizations_url":"https://api.github.com/users/abought/orgs","repos_url":"https://api.github.com/users/abought/repos","events_url":"https://api.github.com/users/abought/events{/privacy}","received_events_url":"https://api.github.com/users/abought/received_events","type":"User","site_admin":false},"body":"Per this note: does this mean that any code after the last assertion can be removed?","created_at":"2017-03-23T20:09:17Z","updated_at":"2017-03-23T20:12:03Z","html_url":"https://github.com/CenterForOpenScience/ember-preprints/pull/293#discussion_r107771162","pull_request_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293","_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/comments/107771162"},"html":{"href":"https://github.com/CenterForOpenScience/ember-preprints/pull/293#discussion_r107771162"},"pull_request":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293"}}},"pull_request":{"url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293","id":109037175,"html_url":"https://github.com/CenterForOpenScience/ember-preprints/pull/293","diff_url":"https://github.com/CenterForOpenScience/ember-preprints/pull/293.diff","patch_url":"https://github.com/CenterForOpenScience/ember-preprints/pull/293.patch","issue_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/293","number":293,"state":"open","locked":false,"title":"[EOSF-510] Add example acceptance tests, controller unit tests, and component integration tests","user":{"login":"hmoco","id":6268982,"avatar_url":"https://avatars3.githubusercontent.com/u/6268982?v=3","gravatar_id":"","url":"https://api.github.com/users/hmoco","html_url":"https://github.com/hmoco","followers_url":"https://api.github.com/users/hmoco/followers","following_url":"https://api.github.com/users/hmoco/following{/other_user}","gists_url":"https://api.github.com/users/hmoco/gists{/gist_id}","starred_url":"https://api.github.com/users/hmoco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmoco/subscriptions","organizations_url":"https://api.github.com/users/hmoco/orgs","repos_url":"https://api.github.com/users/hmoco/repos","events_url":"https://api.github.com/users/hmoco/events{/privacy}","received_events_url":"https://api.github.com/users/hmoco/received_events","type":"User","site_admin":false},"body":"## This will fail travis until https://github.com/CenterForOpenScience/ember-osf/pull/189 is merged.\r\n## Ticket\r\n\r\nhttps://openscience.atlassian.net/browse/EOSF-510\r\n\r\n## Purpose\r\nImprove test coverage, specially by adding example acceptance, integration and controller tests to allow simpler future tests writing.\r\n\r\n## Changes\r\nUse of ember-osf factories\r\n\r\n\r\n\r\n","created_at":"2017-03-03T19:16:11Z","updated_at":"2017-03-23T20:12:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"332936ad43935e9d6758e4df3264d011e365bb83","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293/commits","review_comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293/comments","review_comment_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/293/comments","statuses_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/statuses/93b096d43fab80498e220ca6437761299c53663f","head":{"label":"CenterForOpenScience:feature/tests","ref":"feature/tests","sha":"93b096d43fab80498e220ca6437761299c53663f","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars2.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":63790282,"name":"ember-preprints","full_name":"CenterForOpenScience/ember-preprints","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars2.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/ember-preprints","description":"This is the codebase for OSF Preprints, the open preprint repository network","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints","forks_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/releases{/id}","deployments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/deployments","created_at":"2016-07-20T14:56:36Z","updated_at":"2017-03-19T02:25:34Z","pushed_at":"2017-03-23T18:27:36Z","git_url":"git://github.com/CenterForOpenScience/ember-preprints.git","ssh_url":"git@github.com:CenterForOpenScience/ember-preprints.git","clone_url":"https://github.com/CenterForOpenScience/ember-preprints.git","svn_url":"https://github.com/CenterForOpenScience/ember-preprints","homepage":"https://osf.io/preprints/","size":15088,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":18,"forks":22,"open_issues":18,"watchers":9,"default_branch":"develop"}},"base":{"label":"CenterForOpenScience:develop","ref":"develop","sha":"0bd473fa613d40c50e827d8474aafa809e73836d","user":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars2.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"repo":{"id":63790282,"name":"ember-preprints","full_name":"CenterForOpenScience/ember-preprints","owner":{"login":"CenterForOpenScience","id":3344584,"avatar_url":"https://avatars2.githubusercontent.com/u/3344584?v=3","gravatar_id":"","url":"https://api.github.com/users/CenterForOpenScience","html_url":"https://github.com/CenterForOpenScience","followers_url":"https://api.github.com/users/CenterForOpenScience/followers","following_url":"https://api.github.com/users/CenterForOpenScience/following{/other_user}","gists_url":"https://api.github.com/users/CenterForOpenScience/gists{/gist_id}","starred_url":"https://api.github.com/users/CenterForOpenScience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CenterForOpenScience/subscriptions","organizations_url":"https://api.github.com/users/CenterForOpenScience/orgs","repos_url":"https://api.github.com/users/CenterForOpenScience/repos","events_url":"https://api.github.com/users/CenterForOpenScience/events{/privacy}","received_events_url":"https://api.github.com/users/CenterForOpenScience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CenterForOpenScience/ember-preprints","description":"This is the codebase for OSF Preprints, the open preprint repository network","fork":false,"url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints","forks_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/forks","keys_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/teams","hooks_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/hooks","issue_events_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/events{/number}","events_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/events","assignees_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/assignees{/user}","branches_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/branches{/branch}","tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/tags","blobs_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/refs{/sha}","trees_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/statuses/{sha}","languages_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/languages","stargazers_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/stargazers","contributors_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/contributors","subscribers_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/subscribers","subscription_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/subscription","commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/commits{/sha}","git_commits_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/git/commits{/sha}","comments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/comments{/number}","issue_comment_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/comments{/number}","contents_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/contents/{+path}","compare_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/merges","archive_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/downloads","issues_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues{/number}","pulls_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls{/number}","milestones_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/milestones{/number}","notifications_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/labels{/name}","releases_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/releases{/id}","deployments_url":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/deployments","created_at":"2016-07-20T14:56:36Z","updated_at":"2017-03-19T02:25:34Z","pushed_at":"2017-03-23T18:27:36Z","git_url":"git://github.com/CenterForOpenScience/ember-preprints.git","ssh_url":"git@github.com:CenterForOpenScience/ember-preprints.git","clone_url":"https://github.com/CenterForOpenScience/ember-preprints.git","svn_url":"https://github.com/CenterForOpenScience/ember-preprints","homepage":"https://osf.io/preprints/","size":15088,"stargazers_count":9,"watchers_count":9,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":22,"mirror_url":null,"open_issues_count":18,"forks":22,"open_issues":18,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293"},"html":{"href":"https://github.com/CenterForOpenScience/ember-preprints/pull/293"},"issue":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/293"},"comments":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/issues/293/comments"},"review_comments":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293/comments"},"review_comment":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/pulls/293/commits"},"statuses":{"href":"https://api.github.com/repos/CenterForOpenScience/ember-preprints/statuses/93b096d43fab80498e220ca6437761299c53663f"}}}}
{"actor":{"display_login":"abought"}}