Skip to content

Commit

Permalink
first map inconsist test . Number jce-il#1 passed
Browse files Browse the repository at this point in the history
  • Loading branch information
monder93 committed May 23, 2016
1 parent b00a2a4 commit 2d7fbbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ Map.prototype.find_a_person = function(name) {
return false;
};

Map.prototype.map_inconsist = function(name) {
var counter = 0;
var lngth = this._posts.length;
for (i=0; i<lngth; i++) {
if (this._posts[i].search(name) != -1)
counter++;
if (counter > 1)
return true;
}
return false;
};


module.exports = Map;
4 changes: 2 additions & 2 deletions tests/find-a-person.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var chai = require('chai');
var expect = chai.expect; // we are using the "expect" style of Chai
var Map = require('./../src/map');
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 map = new Map(["I met Or A. at Chabad house Bangkok", "We found Or A. R.I.P at Langtang valley", "We met Amit B. in NYC"]);

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() {
Expand All @@ -20,7 +20,7 @@ describe('Name match found (bool)', function() {


describe('Map inconsistencies test #1', function() {
it('heck if there are map inconsistencies, e.g., the same name with different locations.', function() {
it('check if there are map inconsistencies, e.g., the same name with different locations.', function() {
var posts = map.map_inconsist("Or A.")
expect(posts).to.be.eql(true);
});
Expand Down

0 comments on commit 2d7fbbe

Please sign in to comment.