unittests/tests/utils.js
branchpopcorn-port
changeset 374 138e76fe73a6
parent 369 70bc85b31c6d
--- a/unittests/tests/utils.js	Thu Dec 01 14:59:08 2011 +0100
+++ b/unittests/tests/utils.js	Thu Dec 01 15:43:28 2011 +0100
@@ -42,9 +42,18 @@
   });
   
   test("test function to format a tweet", function() {
-    var input = "@handle @bundle #hashtag http://t.co/11111";
-    var output = "<a href='http://twitter.com/handle'>@handle</a> <a href='http://twitter.com/bundle'>@bundle</a> <a href='http://twitter.com/search?q=%23hashtag'>#hashtag</a> <a href='http://t.co/11111'>http://t.co/11111</a>";
-    equal(IriSP.formatTweet(input), output, "the correct output is given");
+    var inputs = ["@handle", "@bundle", "#hashtag", "http://t.co/11111", "++", "--"];
+    var outputs = ["<a href='http://twitter.com/handle'>@handle</a>", 
+                   "<a href='http://twitter.com/bundle'>@bundle</a>",
+                   "<a href='http://twitter.com/search?q=%23hashtag'>#hashtag</a>",
+                   "<a href='http://t.co/11111'>http://t.co/11111</a>",
+                   "<span class='Ldt-PolemicPlusPlus'>++</span>",
+                   "<span class='Ldt-PolemicMinusMinus'>--</span>"];
+
+    var i = 0;
+    for(i = 0; i < inputs.length; i++) {
+      equal(IriSP.formatTweet(inputs[i]), outputs[i], "the correct output is given");
+    }
   });
 
   test("test function to convert decimal color to hexadecimal", function() {