Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

node 0.8

  • Loading branch information...
commit c473c49012b7e33fa0c05f52202caf60a2727cc2 1 parent b34c592
@vesln authored
View
3  .travis.yml
@@ -1,3 +1,4 @@
language: node_js
node_js:
- - 0.6
+ - 0.6
+ - 0.8
View
3  Makefile
@@ -2,8 +2,7 @@ TESTS = test/*.test.js
test:
@NODE_ENV=test ./node_modules/.bin/mocha \
- --require should \
--reporter spec \
$(TESTS)
-.PHONY: test
+.PHONY: test
View
10 package.json
@@ -9,8 +9,8 @@
"colors": "0.6.0-1"
}
, "devDependencies": {
- "mocha": "0.3.3"
- , "should": "0.3.2"
+ "mocha": "*"
+ , "chai": "*"
}
, "repository" : {
"type" : "git"
@@ -24,7 +24,7 @@
"bot": "./bin/bot"
}
, "main": "./lib/index"
- , "engines": {
- "node": ">= 0.6.0 < 0.7.0"
+ , "engines": {
+ "node": ">= 0.6.0"
}
-}
+}
View
21 test/bot.test.js
@@ -1,13 +1,18 @@
/*!
* Bot - Feeling lonely? You personal bot is here.
- *
+ *
* Veselin Todorov <hi@vesln.com>
* MIT License.
*/
/**
- * The tested class.
- *
+ * Support.
+ */
+var should = require('chai').should();
+
+/**
+ * Subject.
+ *
* @type {Function}
*/
var Bot = require('../lib/bot');
@@ -24,26 +29,26 @@ describe('Bot', function() {
Bot.version.should.be.ok;
});
});
-
+
describe('constructor', function() {
- it('should load db and defaults', function() {
+ it('should load db and defaults', function() {
var bot = new Bot({foo: 'bar'}, ['foo', 'bar']);
bot._db.should.eql({foo: 'bar'});
bot._defaults.should.eql(['foo', 'bar']);
});
});
-
+
describe('.answer()', function() {
it('should answer questions', function() {
var db = new Db;
var bot = new Bot(db);
bot.answer('Hello.').should.eql('"Hello," he lied.');
});
-
+
it('should answer even if he does not know what to say', function() {
var db = new Db;
var bot = new Bot(db, ['foo']);
bot.answer('dasjdisahdia').should.eql('foo');
});
});
-});
+});
View
21 test/db.test.js
@@ -1,13 +1,18 @@
/*!
* Bot - Feeling lonely? You personal bot is here.
- *
+ *
* Veselin Todorov <hi@vesln.com>
* MIT License.
*/
/**
- * The tested class.
- *
+ * Support.
+ */
+var should = require('chai').should();
+
+/**
+ * Subject.
+ *
* @type {Function}
*/
var Db = require('../lib/db');
@@ -23,14 +28,14 @@ describe('Db', function() {
var db = new Db;
(!!db._content).should.be.ok;
});
-
+
it('should use the supplied content', function() {
var content = {foo: 'bar'};
var db = new Db(content);
db._content.should.eql(content);
});
});
-
+
describe('.findOne()', function() {
it('should find the most accurate answer for text', function() {
var text = new Text('People are crazy.');
@@ -38,14 +43,16 @@ describe('Db', function() {
db.findOne(text).should.eql('During these times, when crazy people are running the government, all you can do is laugh.');
});
});
-
+
describe('.findAll()', function() {
it('should find all matches for text', function() {
var text = new Text('Bears are crazy.');
var db = new Db;
var result = db.findAll(text);
+
result.should.be.an.array;
+
(result.length > 0).should.be.true;
});
});
-});
+});
View
15 test/text.test.js
@@ -1,13 +1,18 @@
/*!
* Bot - Feeling lonely? You personal bot is here.
- *
+ *
* Veselin Todorov <hi@vesln.com>
* MIT License.
*/
/**
- * The tested class.
- *
+ * Support.
+ */
+var should = require('chai').should();
+
+/**
+ * Subject.
+ *
* @type {Function}
*/
var Text = require('../lib/text');
@@ -19,11 +24,11 @@ describe('Text', function() {
text._text.should.eql('Hello!');
});
});
-
+
describe('.words()', function() {
it('should remove stop words', function() {
var text = new Text('I love her. Am I an idiot?');
text.words().should.eql(['i', 'love', 'i', 'idiot']);
});
});
-});
+});
Please sign in to comment.
Something went wrong with that request. Please try again.