summaryrefslogtreecommitdiff
path: root/test/who.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/who.test.js')
-rw-r--r--test/who.test.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/who.test.js b/test/who.test.js
new file mode 100644
index 0000000..27a8c70
--- /dev/null
+++ b/test/who.test.js
@@ -0,0 +1,31 @@
+var BitrafBot = require('../lib/BitrafBot.js')
+ , assert = require('assert');
+
+var json = JSON.stringify({ "collection" :
+ {
+ "version" : "1.0",
+ links:[
+ {rel: "self", href: "http://hermes.bitraf.no/~trygvis/checkins/checkins.php?from=yesterday&count=0"}
+ ],
+ "items" : [
+{ data: [ {"name" : "date", "value" : "2012-05-11T08:55:00+02:00"}, {"name" : "account", "value" : "brokenpoly"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T20:41:35+02:00"}, {"name" : "account", "value" : "Flemm"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T20:29:40+02:00"}, {"name" : "account", "value" : "ccscanf"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T19:57:03+02:00"}, {"name" : "account", "value" : "mortehu"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T19:19:03+02:00"}, {"name" : "account", "value" : "haavares"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T18:53:39+02:00"}, {"name" : "account", "value" : "ccscanf"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T18:36:13+02:00"}, {"name" : "account", "value" : "trygvis"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T15:34:22+02:00"}, {"name" : "account", "value" : "mortehu"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T13:04:14+02:00"}, {"name" : "account", "value" : "brokenpoly"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T13:01:13+02:00"}, {"name" : "account", "value" : "odinho"} ], }
+,{ data: [ {"name" : "date", "value" : "2012-05-10T11:10:38+02:00"}, {"name" : "account", "value" : "mortehu"} ], }
+ ],
+ "count": 11 }
+});
+
+describe('Who', function() {
+ it('can parse who', function() {
+ var str = BitrafBot.onWhoEnd(json);
+ assert.equal('Checkins: brokenpoly (08:55), Flemm (20:41), ccscanf (20:29), mortehu (19:57), haavares (19:19), trygvis (18:36), odinho (13:01)', str);
+ });
+});