{"action":"created","issue":{"url":"https://api.github.com/repos/hexojs/hexo/issues/1204","labels_url":"https://api.github.com/repos/hexojs/hexo/issues/1204/labels{/name}","comments_url":"https://api.github.com/repos/hexojs/hexo/issues/1204/comments","events_url":"https://api.github.com/repos/hexojs/hexo/issues/1204/events","html_url":"https://github.com/hexojs/hexo/pull/1204","id":68551150,"number":1204,"title":"More strict error assertion","user":{"login":"naokiy","id":6022981,"avatar_url":"https://avatars.githubusercontent.com/u/6022981?v=3","gravatar_id":"","url":"https://api.github.com/users/naokiy","html_url":"https://github.com/naokiy","followers_url":"https://api.github.com/users/naokiy/followers","following_url":"https://api.github.com/users/naokiy/following{/other_user}","gists_url":"https://api.github.com/users/naokiy/gists{/gist_id}","starred_url":"https://api.github.com/users/naokiy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naokiy/subscriptions","organizations_url":"https://api.github.com/users/naokiy/orgs","repos_url":"https://api.github.com/users/naokiy/repos","events_url":"https://api.github.com/users/naokiy/events{/privacy}","received_events_url":"https://api.github.com/users/naokiy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-15T02:14:59Z","updated_at":"2015-04-15T13:30:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hexojs/hexo/pulls/1204","html_url":"https://github.com/hexojs/hexo/pull/1204","diff_url":"https://github.com/hexojs/hexo/pull/1204.diff","patch_url":"https://github.com/hexojs/hexo/pull/1204.patch"},"body":"I found some of test were not working.\r\n\r\nFor example...\r\n\r\n```javascript\r\nit('name - required', function(){\r\n  return Tag.insert({}).catch(function(err){\r\n    err.should.have.property('message', '`name` is required!');\r\n  });\r\n});\r\n```\r\n\r\nIf `Tag.insert({})` doesn't throw any error, `err.should.have.property` will be skipped.\r\nSo this test didn't check whether hexo throws error or not.\r\n\r\nI added assert.fail() to check it.\r\n\r\n```javascript\r\nit('name - required', function(){\r\n  return Tag.insert({}).then(function(){\r\n    assert.fail();\r\n  }).catch(function(err){\r\n    err.should.have.property('message', '`name` is required!');\r\n  });\r\n});\r\n```\r\n\r\n----\r\n\r\nAnd I found two more problems.\r\n\r\nOne is problem of test. Please check https://github.com/hexojs/hexo/commit/1483589185118ff3ba832b02a4dadb417bec5009.\r\nThe another is https://github.com/hexojs/hexo/commit/f655f594554e8ce574aad8b89448bc695cacc56a\r\n\r\nI fixed these to let test pass."},"comment":{"url":"https://api.github.com/repos/hexojs/hexo/issues/comments/93398852","html_url":"https://github.com/hexojs/hexo/pull/1204#issuecomment-93398852","issue_url":"https://api.github.com/repos/hexojs/hexo/issues/1204","id":93398852,"user":{"login":"tommy351","id":411425,"avatar_url":"https://avatars.githubusercontent.com/u/411425?v=3","gravatar_id":"","url":"https://api.github.com/users/tommy351","html_url":"https://github.com/tommy351","followers_url":"https://api.github.com/users/tommy351/followers","following_url":"https://api.github.com/users/tommy351/following{/other_user}","gists_url":"https://api.github.com/users/tommy351/gists{/gist_id}","starred_url":"https://api.github.com/users/tommy351/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommy351/subscriptions","organizations_url":"https://api.github.com/users/tommy351/orgs","repos_url":"https://api.github.com/users/tommy351/repos","events_url":"https://api.github.com/users/tommy351/events{/privacy}","received_events_url":"https://api.github.com/users/tommy351/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T13:30:11Z","updated_at":"2015-04-15T13:30:11Z","body":"You should use sinon or callback to make sure the assertion is really working. I don't think it's a great idea to throw an error."}}