From 5e5f18afd6baecd82522f59a23956d4748c8e29b Mon Sep 17 00:00:00 2001 From: osyedja Date: Mon, 23 May 2016 15:30:39 +0300 Subject: [PATCH 1/2] GREEN:: Test for finding a name --- src/map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.js b/src/map.js index 52de9f5..4fab613 100644 --- a/src/map.js +++ b/src/map.js @@ -4,7 +4,7 @@ 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"]; }; module.exports = Map; From 98c23e70cde3c9d62c6d1729282af83c086f9238 Mon Sep 17 00:00:00 2001 From: osyedja Date: Mon, 23 May 2016 15:44:18 +0300 Subject: [PATCH 2/2] GREEN:: Test for finding a name --- src/map.js | 10 ++++++++++ tests/find-a-person.js | 17 ++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/map.js b/src/map.js index 4fab613..7ec8387 100644 --- a/src/map.js +++ b/src/map.js @@ -6,5 +6,15 @@ function Map(posts) { 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..4c5de03 100644 --- a/tests/find-a-person.js +++ b/tests/find-a-person.js @@ -2,10 +2,17 @@ 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() { - it('Given a person name, return all posts (of a map) containing her name (in any of a post fields)', function() { +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_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"]); - }); + 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); + }); +}); \ No newline at end of file