{"action":"created","comment":{"url":"https://api.github.com/repos/huboard/huboard-web/pulls/comments/66810697","id":66810697,"diff_hunk":"@@ -0,0 +1,81 @@\n+import Ember from 'ember';\n+import CardMoveMixin from 'app/mixins/cards/card-move';\n+\n+import {\n+  moduleFor,\n+  test\n+} from 'ember-qunit';\n+\n+var sut;\n+\n+function createIssueData(){\n+  return Ember.Object.create({\n+    _data: { order: 2.5 },\n+    data: Ember.Object.create({ id: 123, title: 'test' })\n+  });\n+}\n+\n+function minMaxZeroOrderFixAlgorithm(issue){\n+  var order = issue._data.order;\n+  while(order < 1e-319){ order *= 10; }\n+  while(order > 1e307){ order /= 10; }\n+\n+  return order;\n+}\n+\n+moduleFor('mixin:cards/card-move', 'CardMoveMixin', {\n+  setup: function(){\n+    sut = Ember.Object.\n+      createWithMixins(CardMoveMixin, {});\n+  }\n+});\n+\n+test('move the issue to the top', function(assert){\n+  var cardMover = sut.cardMover;\n+  cardMover.set('orderKey', 'order');\n+\n+  //Moves issue to the top\n+  var issueBelow = createIssueData();\n+  var result = cardMover.moveToTop(issueBelow);\n+  assert.ok(result < issueBelow._data.order, 'The new order is less than the issue below');\n+\n+  //Moves issue to the top when order has been adjusted for MIN_VALUE\n+  issueBelow = createIssueData();\n+  issueBelow._data.order = 5e-324;\n+  issueBelow._data.order = minMaxZeroOrderFixAlgorithm(issueBelow);\n+\n+  result = cardMover.moveToTop(issueBelow);\n+  assert.ok(result < issueBelow._data.order, 'The new order is less than the issue below');\n+\n+  //If issue move is impossible give it a value below the minThreshold\n+  issueBelow = createIssueData();\n+  issueBelow._data.order = 1e-323;\n+\n+  result = cardMover.moveToTop(issueBelow);\n+  assert.ok(result > cardMover.minThreshold, 'The new order is less than the issue below');\n+});\n+\n+test('move the issue to the bottom', function(assert){\n+  var cardMover = sut.cardMover;\n+  cardMover.set('orderKey', 'order');\n+\n+  //Moves issue to the bottom \n+  var issueAbove = createIssueData();\n+  var result = cardMover.moveToBottom(issueAbove);\n+  assert.ok(result > issueAbove._data.order, 'The new order is greater than the issue above');\n+\n+  //Moves issue to the bottom when order has been adjusted for MAX_VALUE\n+  issueAbove = createIssueData();\n+  issueAbove._data.order = Number.MAX_VALUE;\n+  issueAbove._data.order = minMaxZeroOrderFixAlgorithm(issueAbove);\n+\n+  result = cardMover.moveToBottom(issueAbove);\n+  assert.ok(result > issueAbove._data.order, 'The adjusted order is greater than the issue below');\n+\n+  //If issue move is impossible give it a value above the maxThreshold\n+  issueAbove = createIssueData();\n+  issueAbove._data.order = 1.797692738796007e+308;\n+\n+  result = cardMover.moveToTop(issueAbove);\n+  assert.ok(result > cardMover.minThreshold, 'The new order is less than the issue below');","path":"ember-app/tests/unit/mixins/cards/card-move-test.js","position":80,"original_position":80,"commit_id":"e0b0ffd246c41624ba01d00127c5138d942c7bbf","original_commit_id":"e0b0ffd246c41624ba01d00127c5138d942c7bbf","user":{"login":"dahlbyk","id":133987,"avatar_url":"https://avatars.githubusercontent.com/u/133987?v=3","gravatar_id":"","url":"https://api.github.com/users/dahlbyk","html_url":"https://github.com/dahlbyk","followers_url":"https://api.github.com/users/dahlbyk/followers","following_url":"https://api.github.com/users/dahlbyk/following{/other_user}","gists_url":"https://api.github.com/users/dahlbyk/gists{/gist_id}","starred_url":"https://api.github.com/users/dahlbyk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahlbyk/subscriptions","organizations_url":"https://api.github.com/users/dahlbyk/orgs","repos_url":"https://api.github.com/users/dahlbyk/repos","events_url":"https://api.github.com/users/dahlbyk/events{/privacy}","received_events_url":"https://api.github.com/users/dahlbyk/received_events","type":"User","site_admin":false},"body":"Assert message does not match the scenario.","created_at":"2016-06-13T15:18:31Z","updated_at":"2016-06-13T15:18:31Z","html_url":"https://github.com/huboard/huboard-web/pull/314#discussion_r66810697","pull_request_url":"https://api.github.com/repos/huboard/huboard-web/pulls/314","_links":{"self":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/comments/66810697"},"html":{"href":"https://github.com/huboard/huboard-web/pull/314#discussion_r66810697"},"pull_request":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/314"}}},"pull_request":{"url":"https://api.github.com/repos/huboard/huboard-web/pulls/314","id":72577543,"html_url":"https://github.com/huboard/huboard-web/pull/314","diff_url":"https://github.com/huboard/huboard-web/pull/314.diff","patch_url":"https://github.com/huboard/huboard-web/pull/314.patch","issue_url":"https://api.github.com/repos/huboard/huboard-web/issues/314","number":314,"state":"open","locked":false,"title":"[WIP] Fix creating zero order issues on rare occasions","user":{"login":"discorick","id":1130665,"avatar_url":"https://avatars.githubusercontent.com/u/1130665?v=3","gravatar_id":"","url":"https://api.github.com/users/discorick","html_url":"https://github.com/discorick","followers_url":"https://api.github.com/users/discorick/followers","following_url":"https://api.github.com/users/discorick/following{/other_user}","gists_url":"https://api.github.com/users/discorick/gists{/gist_id}","starred_url":"https://api.github.com/users/discorick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discorick/subscriptions","organizations_url":"https://api.github.com/users/discorick/orgs","repos_url":"https://api.github.com/users/discorick/repos","events_url":"https://api.github.com/users/discorick/events{/privacy}","received_events_url":"https://api.github.com/users/discorick/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-03T22:15:30Z","updated_at":"2016-06-13T15:18:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c098b6e1e76a4bbf656be5f666258eb73858d3d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/huboard/huboard-web/pulls/314/commits","review_comments_url":"https://api.github.com/repos/huboard/huboard-web/pulls/314/comments","review_comment_url":"https://api.github.com/repos/huboard/huboard-web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/huboard/huboard-web/issues/314/comments","statuses_url":"https://api.github.com/repos/huboard/huboard-web/statuses/e0b0ffd246c41624ba01d00127c5138d942c7bbf","head":{"label":"huboard:discorick/troubleshoot-zero-sort","ref":"discorick/troubleshoot-zero-sort","sha":"e0b0ffd246c41624ba01d00127c5138d942c7bbf","user":{"login":"huboard","id":1236155,"avatar_url":"https://avatars.githubusercontent.com/u/1236155?v=3","gravatar_id":"","url":"https://api.github.com/users/huboard","html_url":"https://github.com/huboard","followers_url":"https://api.github.com/users/huboard/followers","following_url":"https://api.github.com/users/huboard/following{/other_user}","gists_url":"https://api.github.com/users/huboard/gists{/gist_id}","starred_url":"https://api.github.com/users/huboard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huboard/subscriptions","organizations_url":"https://api.github.com/users/huboard/orgs","repos_url":"https://api.github.com/users/huboard/repos","events_url":"https://api.github.com/users/huboard/events{/privacy}","received_events_url":"https://api.github.com/users/huboard/received_events","type":"Organization","site_admin":false},"repo":{"id":29268631,"name":"huboard-web","full_name":"huboard/huboard-web","owner":{"login":"huboard","id":1236155,"avatar_url":"https://avatars.githubusercontent.com/u/1236155?v=3","gravatar_id":"","url":"https://api.github.com/users/huboard","html_url":"https://github.com/huboard","followers_url":"https://api.github.com/users/huboard/followers","following_url":"https://api.github.com/users/huboard/following{/other_user}","gists_url":"https://api.github.com/users/huboard/gists{/gist_id}","starred_url":"https://api.github.com/users/huboard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huboard/subscriptions","organizations_url":"https://api.github.com/users/huboard/orgs","repos_url":"https://api.github.com/users/huboard/repos","events_url":"https://api.github.com/users/huboard/events{/privacy}","received_events_url":"https://api.github.com/users/huboard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/huboard/huboard-web","description":"GitHub issues made awesome","fork":false,"url":"https://api.github.com/repos/huboard/huboard-web","forks_url":"https://api.github.com/repos/huboard/huboard-web/forks","keys_url":"https://api.github.com/repos/huboard/huboard-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huboard/huboard-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huboard/huboard-web/teams","hooks_url":"https://api.github.com/repos/huboard/huboard-web/hooks","issue_events_url":"https://api.github.com/repos/huboard/huboard-web/issues/events{/number}","events_url":"https://api.github.com/repos/huboard/huboard-web/events","assignees_url":"https://api.github.com/repos/huboard/huboard-web/assignees{/user}","branches_url":"https://api.github.com/repos/huboard/huboard-web/branches{/branch}","tags_url":"https://api.github.com/repos/huboard/huboard-web/tags","blobs_url":"https://api.github.com/repos/huboard/huboard-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huboard/huboard-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huboard/huboard-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/huboard/huboard-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huboard/huboard-web/statuses/{sha}","languages_url":"https://api.github.com/repos/huboard/huboard-web/languages","stargazers_url":"https://api.github.com/repos/huboard/huboard-web/stargazers","contributors_url":"https://api.github.com/repos/huboard/huboard-web/contributors","subscribers_url":"https://api.github.com/repos/huboard/huboard-web/subscribers","subscription_url":"https://api.github.com/repos/huboard/huboard-web/subscription","commits_url":"https://api.github.com/repos/huboard/huboard-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/huboard/huboard-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/huboard/huboard-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/huboard/huboard-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/huboard/huboard-web/contents/{+path}","compare_url":"https://api.github.com/repos/huboard/huboard-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huboard/huboard-web/merges","archive_url":"https://api.github.com/repos/huboard/huboard-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huboard/huboard-web/downloads","issues_url":"https://api.github.com/repos/huboard/huboard-web/issues{/number}","pulls_url":"https://api.github.com/repos/huboard/huboard-web/pulls{/number}","milestones_url":"https://api.github.com/repos/huboard/huboard-web/milestones{/number}","notifications_url":"https://api.github.com/repos/huboard/huboard-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huboard/huboard-web/labels{/name}","releases_url":"https://api.github.com/repos/huboard/huboard-web/releases{/id}","deployments_url":"https://api.github.com/repos/huboard/huboard-web/deployments","created_at":"2015-01-14T22:17:00Z","updated_at":"2016-05-31T16:56:03Z","pushed_at":"2016-06-11T21:40:54Z","git_url":"git://github.com/huboard/huboard-web.git","ssh_url":"git@github.com:huboard/huboard-web.git","clone_url":"https://github.com/huboard/huboard-web.git","svn_url":"https://github.com/huboard/huboard-web","homepage":"https://huboard.com","size":24551,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":32,"forks":21,"open_issues":32,"watchers":33,"default_branch":"master"}},"base":{"label":"huboard:master","ref":"master","sha":"5462c0797b242ff4facf51a9cd71e6bb629358ed","user":{"login":"huboard","id":1236155,"avatar_url":"https://avatars.githubusercontent.com/u/1236155?v=3","gravatar_id":"","url":"https://api.github.com/users/huboard","html_url":"https://github.com/huboard","followers_url":"https://api.github.com/users/huboard/followers","following_url":"https://api.github.com/users/huboard/following{/other_user}","gists_url":"https://api.github.com/users/huboard/gists{/gist_id}","starred_url":"https://api.github.com/users/huboard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huboard/subscriptions","organizations_url":"https://api.github.com/users/huboard/orgs","repos_url":"https://api.github.com/users/huboard/repos","events_url":"https://api.github.com/users/huboard/events{/privacy}","received_events_url":"https://api.github.com/users/huboard/received_events","type":"Organization","site_admin":false},"repo":{"id":29268631,"name":"huboard-web","full_name":"huboard/huboard-web","owner":{"login":"huboard","id":1236155,"avatar_url":"https://avatars.githubusercontent.com/u/1236155?v=3","gravatar_id":"","url":"https://api.github.com/users/huboard","html_url":"https://github.com/huboard","followers_url":"https://api.github.com/users/huboard/followers","following_url":"https://api.github.com/users/huboard/following{/other_user}","gists_url":"https://api.github.com/users/huboard/gists{/gist_id}","starred_url":"https://api.github.com/users/huboard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/huboard/subscriptions","organizations_url":"https://api.github.com/users/huboard/orgs","repos_url":"https://api.github.com/users/huboard/repos","events_url":"https://api.github.com/users/huboard/events{/privacy}","received_events_url":"https://api.github.com/users/huboard/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/huboard/huboard-web","description":"GitHub issues made awesome","fork":false,"url":"https://api.github.com/repos/huboard/huboard-web","forks_url":"https://api.github.com/repos/huboard/huboard-web/forks","keys_url":"https://api.github.com/repos/huboard/huboard-web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/huboard/huboard-web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/huboard/huboard-web/teams","hooks_url":"https://api.github.com/repos/huboard/huboard-web/hooks","issue_events_url":"https://api.github.com/repos/huboard/huboard-web/issues/events{/number}","events_url":"https://api.github.com/repos/huboard/huboard-web/events","assignees_url":"https://api.github.com/repos/huboard/huboard-web/assignees{/user}","branches_url":"https://api.github.com/repos/huboard/huboard-web/branches{/branch}","tags_url":"https://api.github.com/repos/huboard/huboard-web/tags","blobs_url":"https://api.github.com/repos/huboard/huboard-web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/huboard/huboard-web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/huboard/huboard-web/git/refs{/sha}","trees_url":"https://api.github.com/repos/huboard/huboard-web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/huboard/huboard-web/statuses/{sha}","languages_url":"https://api.github.com/repos/huboard/huboard-web/languages","stargazers_url":"https://api.github.com/repos/huboard/huboard-web/stargazers","contributors_url":"https://api.github.com/repos/huboard/huboard-web/contributors","subscribers_url":"https://api.github.com/repos/huboard/huboard-web/subscribers","subscription_url":"https://api.github.com/repos/huboard/huboard-web/subscription","commits_url":"https://api.github.com/repos/huboard/huboard-web/commits{/sha}","git_commits_url":"https://api.github.com/repos/huboard/huboard-web/git/commits{/sha}","comments_url":"https://api.github.com/repos/huboard/huboard-web/comments{/number}","issue_comment_url":"https://api.github.com/repos/huboard/huboard-web/issues/comments{/number}","contents_url":"https://api.github.com/repos/huboard/huboard-web/contents/{+path}","compare_url":"https://api.github.com/repos/huboard/huboard-web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/huboard/huboard-web/merges","archive_url":"https://api.github.com/repos/huboard/huboard-web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/huboard/huboard-web/downloads","issues_url":"https://api.github.com/repos/huboard/huboard-web/issues{/number}","pulls_url":"https://api.github.com/repos/huboard/huboard-web/pulls{/number}","milestones_url":"https://api.github.com/repos/huboard/huboard-web/milestones{/number}","notifications_url":"https://api.github.com/repos/huboard/huboard-web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/huboard/huboard-web/labels{/name}","releases_url":"https://api.github.com/repos/huboard/huboard-web/releases{/id}","deployments_url":"https://api.github.com/repos/huboard/huboard-web/deployments","created_at":"2015-01-14T22:17:00Z","updated_at":"2016-05-31T16:56:03Z","pushed_at":"2016-06-11T21:40:54Z","git_url":"git://github.com/huboard/huboard-web.git","ssh_url":"git@github.com:huboard/huboard-web.git","clone_url":"https://github.com/huboard/huboard-web.git","svn_url":"https://github.com/huboard/huboard-web","homepage":"https://huboard.com","size":24551,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":21,"mirror_url":null,"open_issues_count":32,"forks":21,"open_issues":32,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/314"},"html":{"href":"https://github.com/huboard/huboard-web/pull/314"},"issue":{"href":"https://api.github.com/repos/huboard/huboard-web/issues/314"},"comments":{"href":"https://api.github.com/repos/huboard/huboard-web/issues/314/comments"},"review_comments":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/314/comments"},"review_comment":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/huboard/huboard-web/pulls/314/commits"},"statuses":{"href":"https://api.github.com/repos/huboard/huboard-web/statuses/e0b0ffd246c41624ba01d00127c5138d942c7bbf"}}}}
{"actor":{"display_login":"dahlbyk"}}