{"action":"created","comment":{"url":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments/125237223","pull_request_review_id":47606825,"id":125237223,"diff_hunk":"@@ -0,0 +1,156 @@\n+var should = require('should');\n+var helper = require('../helper');\n+var validate = require('bateeq-models').validator.master;\n+var generateCode = require('../../src/utils/code-generator');\n+var manager;\n+\n+function getData() {\n+    var RangeDiscProduct = require('bateeq-models').master.RangeDiscProduct;\n+    var rangeDiscProduct = new RangeDiscProduct();\n+\n+    var code = generateCode('UnitTest');\n+\n+    rangeDiscProduct.code = code;\n+    rangeDiscProduct.name = `name[${code}]`;\n+    rangeDiscProduct.description = `description for ${code}`; \n+\n+    return rangeDiscProduct;\n+}\n+\n+before('#00. connect db', function(done) {\n+    helper.getDb()\n+        .then(db => {\n+            var RangeDiscProductManager = require('../../src/managers/master/range-disc-product-manager');\n+            manager = new RangeDiscProductManager(db, {\n+                username: 'unit-test'\n+            });\n+            done();\n+        })\n+        .catch(e => {\n+            done(e);\n+        })\n+});\n+\n+var createdId;\n+it('#01. should success when create new data', function(done) {\n+    var data = getData();\n+    manager.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(`#02. should success when get created data with id`, function(done) {\n+    manager.getSingleByQuery({\n+            _id: createdId\n+        })\n+        .then(data => {\n+            validate.rangeDiscProduct(data);\n+            createdData = data;\n+            done();\n+        })\n+        .catch(e => {\n+            done(e);\n+        })\n+});\n+\n+it(`#03. should success when update created data`, function(done) {\n+\n+    createdData.code += '[updated]';\n+    createdData.name += '[updated]';\n+    createdData.description += '[updated]'; \n+\n+    manager.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(`#04. should success when get updated data with id`, function(done) {\n+    manager.getSingleByQuery({\n+            _id: createdId\n+        })\n+        .then(data => {\n+            validate.rangeDiscProduct(data);\n+            data.code.should.equal(createdData.code);\n+            data.name.should.equal(createdData.name);\n+            data.description.should.equal(createdData.description); \n+            done();\n+        })\n+        .catch(e => {\n+            done(e);\n+        })\n+});\n+\n+it(`#05. should success when delete data`, function(done) {\n+    manager.delete(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 _deleted=true`, function(done) {\n+    manager.getSingleByQuery({\n+            _id: createdId\n+        })\n+        .then(data => {\n+            validate.rangeDiscProduct(data);\n+            data._deleted.should.be.Boolean();\n+            data._deleted.should.equal(true);\n+            done();\n+        })\n+        .catch(e => {\n+            done(e);\n+        })\n+});\n+\n+it('#07. should error when create new data with same code', function(done) {\n+    var data = Object.assign({}, createdData);\n+    delete data._id;\n+    manager.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('#08. should error with property code and name ', function(done) {\n+    manager.create({})\n+        .then(id => {\n+            done(\"Should not be error with property code and name\");\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(ex);\n+            }\n+        })","path":"test/managers/range-disc-product-test.js","position":155,"original_position":155,"commit_id":"ab5d8ef1820a1c1ac1e1aac65cd3c65f5e00e461","original_commit_id":"ab5d8ef1820a1c1ac1e1aac65cd3c65f5e00e461","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars3.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":"Missing semicolon.","created_at":"2017-07-03T08:46:39Z","updated_at":"2017-07-03T08:46:40Z","html_url":"https://github.com/danliris/bateeq-module/pull/301#discussion_r125237223","pull_request_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/301","_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/comments/125237223"},"html":{"href":"https://github.com/danliris/bateeq-module/pull/301#discussion_r125237223"},"pull_request":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/danliris/bateeq-module/pulls/301","id":128317917,"html_url":"https://github.com/danliris/bateeq-module/pull/301","diff_url":"https://github.com/danliris/bateeq-module/pull/301.diff","patch_url":"https://github.com/danliris/bateeq-module/pull/301.patch","issue_url":"https://api.github.com/repos/danliris/bateeq-module/issues/301","number":301,"state":"open","locked":false,"title":"Add module range diskon produk","user":{"login":"stvyang-m","id":29571772,"avatar_url":"https://avatars0.githubusercontent.com/u/29571772?v=3","gravatar_id":"","url":"https://api.github.com/users/stvyang-m","html_url":"https://github.com/stvyang-m","followers_url":"https://api.github.com/users/stvyang-m/followers","following_url":"https://api.github.com/users/stvyang-m/following{/other_user}","gists_url":"https://api.github.com/users/stvyang-m/gists{/gist_id}","starred_url":"https://api.github.com/users/stvyang-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stvyang-m/subscriptions","organizations_url":"https://api.github.com/users/stvyang-m/orgs","repos_url":"https://api.github.com/users/stvyang-m/repos","events_url":"https://api.github.com/users/stvyang-m/events{/privacy}","received_events_url":"https://api.github.com/users/stvyang-m/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-06-30T08:18:07Z","updated_at":"2017-07-03T08:46:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"536f4affd336b83613541db13fc686d49cbf2cd7","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/301/commits","review_comments_url":"https://api.github.com/repos/danliris/bateeq-module/pulls/301/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/301/comments","statuses_url":"https://api.github.com/repos/danliris/bateeq-module/statuses/ab5d8ef1820a1c1ac1e1aac65cd3c65f5e00e461","head":{"label":"stvyang-m:dev","ref":"dev","sha":"ab5d8ef1820a1c1ac1e1aac65cd3c65f5e00e461","user":{"login":"stvyang-m","id":29571772,"avatar_url":"https://avatars0.githubusercontent.com/u/29571772?v=3","gravatar_id":"","url":"https://api.github.com/users/stvyang-m","html_url":"https://github.com/stvyang-m","followers_url":"https://api.github.com/users/stvyang-m/followers","following_url":"https://api.github.com/users/stvyang-m/following{/other_user}","gists_url":"https://api.github.com/users/stvyang-m/gists{/gist_id}","starred_url":"https://api.github.com/users/stvyang-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stvyang-m/subscriptions","organizations_url":"https://api.github.com/users/stvyang-m/orgs","repos_url":"https://api.github.com/users/stvyang-m/repos","events_url":"https://api.github.com/users/stvyang-m/events{/privacy}","received_events_url":"https://api.github.com/users/stvyang-m/received_events","type":"User","site_admin":false},"repo":{"id":94883974,"name":"bateeq-module","full_name":"stvyang-m/bateeq-module","owner":{"login":"stvyang-m","id":29571772,"avatar_url":"https://avatars0.githubusercontent.com/u/29571772?v=3","gravatar_id":"","url":"https://api.github.com/users/stvyang-m","html_url":"https://github.com/stvyang-m","followers_url":"https://api.github.com/users/stvyang-m/followers","following_url":"https://api.github.com/users/stvyang-m/following{/other_user}","gists_url":"https://api.github.com/users/stvyang-m/gists{/gist_id}","starred_url":"https://api.github.com/users/stvyang-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stvyang-m/subscriptions","organizations_url":"https://api.github.com/users/stvyang-m/orgs","repos_url":"https://api.github.com/users/stvyang-m/repos","events_url":"https://api.github.com/users/stvyang-m/events{/privacy}","received_events_url":"https://api.github.com/users/stvyang-m/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stvyang-m/bateeq-module","description":"bateeq module","fork":true,"url":"https://api.github.com/repos/stvyang-m/bateeq-module","forks_url":"https://api.github.com/repos/stvyang-m/bateeq-module/forks","keys_url":"https://api.github.com/repos/stvyang-m/bateeq-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stvyang-m/bateeq-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stvyang-m/bateeq-module/teams","hooks_url":"https://api.github.com/repos/stvyang-m/bateeq-module/hooks","issue_events_url":"https://api.github.com/repos/stvyang-m/bateeq-module/issues/events{/number}","events_url":"https://api.github.com/repos/stvyang-m/bateeq-module/events","assignees_url":"https://api.github.com/repos/stvyang-m/bateeq-module/assignees{/user}","branches_url":"https://api.github.com/repos/stvyang-m/bateeq-module/branches{/branch}","tags_url":"https://api.github.com/repos/stvyang-m/bateeq-module/tags","blobs_url":"https://api.github.com/repos/stvyang-m/bateeq-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stvyang-m/bateeq-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stvyang-m/bateeq-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/stvyang-m/bateeq-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stvyang-m/bateeq-module/statuses/{sha}","languages_url":"https://api.github.com/repos/stvyang-m/bateeq-module/languages","stargazers_url":"https://api.github.com/repos/stvyang-m/bateeq-module/stargazers","contributors_url":"https://api.github.com/repos/stvyang-m/bateeq-module/contributors","subscribers_url":"https://api.github.com/repos/stvyang-m/bateeq-module/subscribers","subscription_url":"https://api.github.com/repos/stvyang-m/bateeq-module/subscription","commits_url":"https://api.github.com/repos/stvyang-m/bateeq-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/stvyang-m/bateeq-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/stvyang-m/bateeq-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/stvyang-m/bateeq-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/stvyang-m/bateeq-module/contents/{+path}","compare_url":"https://api.github.com/repos/stvyang-m/bateeq-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stvyang-m/bateeq-module/merges","archive_url":"https://api.github.com/repos/stvyang-m/bateeq-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stvyang-m/bateeq-module/downloads","issues_url":"https://api.github.com/repos/stvyang-m/bateeq-module/issues{/number}","pulls_url":"https://api.github.com/repos/stvyang-m/bateeq-module/pulls{/number}","milestones_url":"https://api.github.com/repos/stvyang-m/bateeq-module/milestones{/number}","notifications_url":"https://api.github.com/repos/stvyang-m/bateeq-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stvyang-m/bateeq-module/labels{/name}","releases_url":"https://api.github.com/repos/stvyang-m/bateeq-module/releases{/id}","deployments_url":"https://api.github.com/repos/stvyang-m/bateeq-module/deployments","created_at":"2017-06-20T11:28:22Z","updated_at":"2017-06-20T11:28:24Z","pushed_at":"2017-07-03T08:46:28Z","git_url":"git://github.com/stvyang-m/bateeq-module.git","ssh_url":"git@github.com:stvyang-m/bateeq-module.git","clone_url":"https://github.com/stvyang-m/bateeq-module.git","svn_url":"https://github.com/stvyang-m/bateeq-module","homepage":null,"size":1232,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"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":"danliris:dev","ref":"dev","sha":"9730ba1a411d6d3c2087e059f870dd8f6d36222c","user":{"login":"danliris","id":20855729,"avatar_url":"https://avatars3.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://avatars3.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":"2017-07-03T08:46:30Z","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":1233,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":1,"forks":16,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/301"},"html":{"href":"https://github.com/danliris/bateeq-module/pull/301"},"issue":{"href":"https://api.github.com/repos/danliris/bateeq-module/issues/301"},"comments":{"href":"https://api.github.com/repos/danliris/bateeq-module/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/danliris/bateeq-module/pulls/301/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/301/commits"},"statuses":{"href":"https://api.github.com/repos/danliris/bateeq-module/statuses/ab5d8ef1820a1c1ac1e1aac65cd3c65f5e00e461"}}}}
{"actor":{"display_login":"houndci-bot"}}