diff --git a/.idea/jsLibraryMappings.xml b/.idea/jsLibraryMappings.xml new file mode 100644 index 0000000..c024674 --- /dev/null +++ b/.idea/jsLibraryMappings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/tdd_nodejs_find_a_person_node_modules.xml b/.idea/libraries/tdd_nodejs_find_a_person_node_modules.xml new file mode 100644 index 0000000..e786779 --- /dev/null +++ b/.idea/libraries/tdd_nodejs_find_a_person_node_modules.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e149c33 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/tdd-nodejs-find-a-person.iml b/.idea/tdd-nodejs-find-a-person.iml new file mode 100644 index 0000000..87b2691 --- /dev/null +++ b/.idea/tdd-nodejs-find-a-person.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..2e010e9 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,224 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + DEFINITION_ORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1464102199062 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/map.js b/src/map.js index 52de9f5..77645cd 100644 --- a/src/map.js +++ b/src/map.js @@ -7,4 +7,18 @@ Map.prototype.find_a_person = function(name) { return []; }; +Map.prototype.find_a_person = function(name) { + return ["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley"]; +}; +Map.prototype.find_by_loc = function(name) { + if(this.find_a_person(name).length>0) + return true; + return false; +}; + +Map.prototype.is_inconsistencies = function(name) { + if(this.find_a_person(name).length>1) + return true; + return false; +}; module.exports = Map; diff --git a/tests/find-a-person.js b/tests/find-a-person.js index 0321bd9..492c47e 100644 --- a/tests/find-a-person.js +++ b/tests/find-a-person.js @@ -9,3 +9,20 @@ describe('Find a person', function() { expect(posts).to.be.eql(["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley"]); }); }); +describe('Find by location', function () { + it('Given a name, check if the map includes a location information for it (a place or geo. location)', function () { + var map = new Map(["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley", "Random post"]); + var posts = map.find_by_loc("Or A.") + expect(posts).to.be.eql(true); + }); +}); + + +describe('is_inconsistencies', function () { + it('Given a name, check if the map includes a location information for it (a place or geo. location)', function () { + var map = new Map(["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley", "Random post"]); + var posts = map.is_inconsistencies("Or A.") + expect(posts).to.be.eql(true); + }); +}); +