{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments/93220789","pull_request_review_id":13742221,"id":93220789,"diff_hunk":"@@ -0,0 +1,218 @@\n+var should = require(\"should\");\n+var helper = require(\"../../../helper\");\n+var Supplier = require(\"../../../data-util/master/supplier-manager-data-util\");\n+var SupplierManager = require(\"../../../../src/managers/master/supplier-manager\");\n+var validate = require(\"bateeq-models\").validator.master.supplier;\n+var instanceManager = null;\n+\n+\n+before(\"#00. connect db\", function (done) {\n+    helper.getDb()\n+        .then((db) => {\n+            instanceManager = new SupplierManager(db, {\n+                username: \"unit-test\"\n+            });\n+            done();\n+        })\n+        .catch((e) => {\n+            done(e);\n+        });\n+});\n+\n+it(\"#01. should error when create new supplier with empty data\", function(done) {\n+    instanceManager.create({})\n+        .then((id) => {\n+            done(\"Should not be able to create data with empty data\");\n+        })\n+        .catch((e) => {\n+            try {\n+                e.errors.should.have.property(\"code\");\n+                e.errors.should.have.property(\"name\");\n+                done();\n+            }\n+            catch (ex) {\n+                done(e);\n+            }\n+        });\n+});\n+\n+var createdId;\n+it(\"#02. should success when create new data\", function (done) {\n+    Supplier.getNewData()\n+        .then((data) => instanceManager.create(data))\n+        .then((id) => {\n+            id.should.be.Object();\n+            createdId = id;\n+            done();\n+        })\n+        .catch((e) => {\n+            done(e);\n+        });\n+});\n+\n+var createdData;\n+it(\"#03. should success when get created data with id\", function (done) {\n+    instanceManager.getSingleByQuery({\n+        _id: createdId\n+    })\n+        .then((data) => {\n+            data.should.instanceof(Object);\n+            validate(data);\n+            createdData = data;\n+            done();\n+        })\n+        .catch((e) => {\n+            done(e);\n+        });\n+});\n+\n+it(\"#04. should error when create new data with same code\", function (done) {\n+    var data = Object.assign({}, createdData);\n+    delete data._id;\n+    instanceManager.create(data)\n+        .then((id) => {\n+            id.should.be.Object();\n+            createdId = id;\n+            done(\"Should not be able to create data with same code\");\n+        })\n+        .catch((e) => {\n+            try {\n+                e.errors.should.have.property(\"code\");\n+                done();\n+            }\n+            catch (e) {\n+                done(e);\n+            }\n+        });\n+});\n+\n+it(\"#05. should success when update created data\", function (done) {\n+\n+    createdData.code += \"[updated]\";\n+    createdData.name += \"[updated]\";\n+    createdData.description += \"[updated]\";\n+    createdData.phone += \"[updated]\";\n+    createdData.address += \"[updated]\";\n+\n+    instanceManager.update(createdData)\n+        .then((id) => {\n+            createdId.toString().should.equal(id.toString());\n+            done();\n+        })\n+        .catch((e) => {\n+            done(e);\n+        });\n+});\n+\n+it(\"#06. should success when get updated data with id\", function (done) {\n+    instanceManager.getSingleByQuery({\n+        _id: createdId\n+    })\n+        .then((data) => {\n+            validate(data);\n+            data.code.should.equal(createdData.code);\n+            data.name.should.equal(createdData.name);\n+            data.description.should.equal(createdData.description);\n+            data.phone.should.equal(createdData.phone);\n+            data.address.should.equal(createdData.address);\n+            done();\n+        })\n+        .catch((e) => {\n+            done(e);\n+        });\n+});\n+\n+\n+it(\"#07. should error when update new data with same code\", function(done) {\n+    var newDataId;\n+    Supplier.getNewData()\n+        .then((data) => instanceManager.create(data))\n+        .then((newId) => instanceManager.getSingleById(newId))\n+        .then((newData) => {\n+            newDataId = newData._id;\n+            newData.code = createdData.code;\n+            return instanceManager.update(newData);\n+        })\n+        .then((id) => {\n+            done(\"Should not be able to update data with same code\");\n+        })\n+        .catch((e) => {\n+            try {\n+                e.errors.should.have.property(\"code\");\n+                instanceManager.destroy(newDataId)\n+                    .then(() => done());","path":"test/managers/master/supplier/basic.js","position":143,"original_position":143,"commit_id":"9697c0b4b60a2aef2ca0c03cd2f92c57de27a97f","original_commit_id":"9697c0b4b60a2aef2ca0c03cd2f92c57de27a97f","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').","created_at":"2016-12-20T11:41:23Z","updated_at":"2016-12-20T11:41:23Z","html_url":"https://github.com/danliris/bateeq-module/pull/98#discussion_r93220789","pull_request_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/98","_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments/93220789"},"html":{"href":"https://github.com/danliris/bateeq-module/pull/98#discussion_r93220789"},"pull_request":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/bateeq-module/pulls/98","id":98733169,"html_url":"https://github.com/danliris/bateeq-module/pull/98","diff_url":"https://github.com/danliris/bateeq-module/pull/98.diff","patch_url":"https://github.com/danliris/bateeq-module/pull/98.patch","issue_url":"https://api.github.com/repos/danliris/bateeq-module/issues/98","number":98,"state":"open","locked":false,"title":"UAT to PRD 20 Dec 2016","user":{"login":"fendywillyam","id":24405641,"avatar_url":"https://avatars.githubusercontent.com/u/24405641?v=3","gravatar_id":"","url":"https://api.github.com/users/fendywillyam","html_url":"https://github.com/fendywillyam","followers_url":"https://api.github.com/users/fendywillyam/followers","following_url":"https://api.github.com/users/fendywillyam/following{/other_user}","gists_url":"https://api.github.com/users/fendywillyam/gists{/gist_id}","starred_url":"https://api.github.com/users/fendywillyam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fendywillyam/subscriptions","organizations_url":"https://api.github.com/users/fendywillyam/orgs","repos_url":"https://api.github.com/users/fendywillyam/repos","events_url":"https://api.github.com/users/fendywillyam/events{/privacy}","received_events_url":"https://api.github.com/users/fendywillyam/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-20T11:40:52Z","updated_at":"2016-12-20T11:41:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/98/commits","review_comments_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/98/comments","review_comment_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments{/number}","comments_url":"https://api.github.com/repos/danliris/bateeq-module/issues/98/comments","statuses_url":"https://api.github.com/repos/danliris/bateeq-module/statuses/9697c0b4b60a2aef2ca0c03cd2f92c57de27a97f","head":{"label":"danliris:uat","ref":"uat","sha":"9697c0b4b60a2aef2ca0c03cd2f92c57de27a97f","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":61858352,"name":"bateeq-module","full_name":"danliris/bateeq-module","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/bateeq-module","description":"bateeq module","fork":false,"url":"https://api.github.com/repos/danliris/bateeq-module","forks_url":"https://api.github.com/repos/danliris/bateeq-module/forks","keys_url":"https://api.github.com/repos/danliris/bateeq-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/bateeq-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/bateeq-module/teams","hooks_url":"https://api.github.com/repos/danliris/bateeq-module/hooks","issue_events_url":"https://api.github.com/repos/danliris/bateeq-module/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/bateeq-module/events","assignees_url":"https://api.github.com/repos/danliris/bateeq-module/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/bateeq-module/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/bateeq-module/tags","blobs_url":"https://api.github.com/repos/danliris/bateeq-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/bateeq-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/bateeq-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/bateeq-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/bateeq-module/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/bateeq-module/languages","stargazers_url":"https://api.github.com/repos/danliris/bateeq-module/stargazers","contributors_url":"https://api.github.com/repos/danliris/bateeq-module/contributors","subscribers_url":"https://api.github.com/repos/danliris/bateeq-module/subscribers","subscription_url":"https://api.github.com/repos/danliris/bateeq-module/subscription","commits_url":"https://api.github.com/repos/danliris/bateeq-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/bateeq-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/bateeq-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/bateeq-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/bateeq-module/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/bateeq-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/bateeq-module/merges","archive_url":"https://api.github.com/repos/danliris/bateeq-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/bateeq-module/downloads","issues_url":"https://api.github.com/repos/danliris/bateeq-module/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/bateeq-module/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/bateeq-module/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/bateeq-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/bateeq-module/labels{/name}","releases_url":"https://api.github.com/repos/danliris/bateeq-module/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/bateeq-module/deployments","created_at":"2016-06-24T05:10:07Z","updated_at":"2016-08-08T03:26:08Z","pushed_at":"2016-12-20T11:40:53Z","git_url":"git://github.com/danliris/bateeq-module.git","ssh_url":"git@github.com:danliris/bateeq-module.git","clone_url":"https://github.com/danliris/bateeq-module.git","svn_url":"https://github.com/danliris/bateeq-module","homepage":null,"size":716,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"danliris:master","ref":"master","sha":"70111291a153223a32e70d58c1587b35abe61032","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"repo":{"id":61858352,"name":"bateeq-module","full_name":"danliris/bateeq-module","owner":{"login":"danliris","id":20855729,"avatar_url":"https://avatars.githubusercontent.com/u/20855729?v=3","gravatar_id":"","url":"https://api.github.com/users/danliris","html_url":"https://github.com/danliris","followers_url":"https://api.github.com/users/danliris/followers","following_url":"https://api.github.com/users/danliris/following{/other_user}","gists_url":"https://api.github.com/users/danliris/gists{/gist_id}","starred_url":"https://api.github.com/users/danliris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danliris/subscriptions","organizations_url":"https://api.github.com/users/danliris/orgs","repos_url":"https://api.github.com/users/danliris/repos","events_url":"https://api.github.com/users/danliris/events{/privacy}","received_events_url":"https://api.github.com/users/danliris/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danliris/bateeq-module","description":"bateeq module","fork":false,"url":"https://api.github.com/repos/danliris/bateeq-module","forks_url":"https://api.github.com/repos/danliris/bateeq-module/forks","keys_url":"https://api.github.com/repos/danliris/bateeq-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danliris/bateeq-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danliris/bateeq-module/teams","hooks_url":"https://api.github.com/repos/danliris/bateeq-module/hooks","issue_events_url":"https://api.github.com/repos/danliris/bateeq-module/issues/events{/number}","events_url":"https://api.github.com/repos/danliris/bateeq-module/events","assignees_url":"https://api.github.com/repos/danliris/bateeq-module/assignees{/user}","branches_url":"https://api.github.com/repos/danliris/bateeq-module/branches{/branch}","tags_url":"https://api.github.com/repos/danliris/bateeq-module/tags","blobs_url":"https://api.github.com/repos/danliris/bateeq-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danliris/bateeq-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danliris/bateeq-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/danliris/bateeq-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danliris/bateeq-module/statuses/{sha}","languages_url":"https://api.github.com/repos/danliris/bateeq-module/languages","stargazers_url":"https://api.github.com/repos/danliris/bateeq-module/stargazers","contributors_url":"https://api.github.com/repos/danliris/bateeq-module/contributors","subscribers_url":"https://api.github.com/repos/danliris/bateeq-module/subscribers","subscription_url":"https://api.github.com/repos/danliris/bateeq-module/subscription","commits_url":"https://api.github.com/repos/danliris/bateeq-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/danliris/bateeq-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/danliris/bateeq-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/danliris/bateeq-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/danliris/bateeq-module/contents/{+path}","compare_url":"https://api.github.com/repos/danliris/bateeq-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danliris/bateeq-module/merges","archive_url":"https://api.github.com/repos/danliris/bateeq-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danliris/bateeq-module/downloads","issues_url":"https://api.github.com/repos/danliris/bateeq-module/issues{/number}","pulls_url":"https://api.github.com/repos/danliris/bateeq-module/pulls{/number}","milestones_url":"https://api.github.com/repos/danliris/bateeq-module/milestones{/number}","notifications_url":"https://api.github.com/repos/danliris/bateeq-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danliris/bateeq-module/labels{/name}","releases_url":"https://api.github.com/repos/danliris/bateeq-module/releases{/id}","deployments_url":"https://api.github.com/repos/danliris/bateeq-module/deployments","created_at":"2016-06-24T05:10:07Z","updated_at":"2016-08-08T03:26:08Z","pushed_at":"2016-12-20T11:40:53Z","git_url":"git://github.com/danliris/bateeq-module.git","ssh_url":"git@github.com:danliris/bateeq-module.git","clone_url":"https://github.com/danliris/bateeq-module.git","svn_url":"https://github.com/danliris/bateeq-module","homepage":null,"size":716,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/98"},"html":{"href":"https://github.com/danliris/bateeq-module/pull/98"},"issue":{"href":"https://api.github.com/repos/danliris/bateeq-module/issues/98"},"comments":{"href":"https://api.github.com/repos/danliris/bateeq-module/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/bateeq-module/statuses/9697c0b4b60a2aef2ca0c03cd2f92c57de27a97f"}}}}
{"actor":{"display_login":"houndci-bot"}}