+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/map.js b/src/map.js
index 52de9f5..ca74ab8 100644
--- a/src/map.js
+++ b/src/map.js
@@ -4,7 +4,17 @@ function Map(posts) {
}
Map.prototype.find_a_person = function(name) {
- return [];
- };
+ 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..9ffde5a 100644
--- a/tests/find-a-person.js
+++ b/tests/find-a-person.js
@@ -2,10 +2,24 @@ var chai = require('chai');
var expect = chai.expect; // we are using the "expect" style of Chai
var Map = require('./../src/map');
-describe('Find a person', function() {
+describe('Find a person',function() {
it('Given a person name, return all posts (of a map) containing her name (in any of a post fields)', 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_a_person("Or A.")
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);
+ });
+ });
});