40 ok(r.hours === h && r.minutes === m && r.seconds === s, "the function is immune to negative numbers."); |
40 ok(r.hours === h && r.minutes === m && r.seconds === s, "the function is immune to negative numbers."); |
41 equal(IriSP.secondsToTime(t), "13:07:41"); |
41 equal(IriSP.secondsToTime(t), "13:07:41"); |
42 }); |
42 }); |
43 |
43 |
44 test("test function to format a tweet", function() { |
44 test("test function to format a tweet", function() { |
45 var input = "@handle @bundle #hashtag http://t.co/11111"; |
45 var inputs = ["@handle", "@bundle", "#hashtag", "http://t.co/11111", "++", "--"]; |
46 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>"; |
46 var outputs = ["<a href='http://twitter.com/handle'>@handle</a>", |
47 equal(IriSP.formatTweet(input), output, "the correct output is given"); |
47 "<a href='http://twitter.com/bundle'>@bundle</a>", |
|
48 "<a href='http://twitter.com/search?q=%23hashtag'>#hashtag</a>", |
|
49 "<a href='http://t.co/11111'>http://t.co/11111</a>", |
|
50 "<span class='Ldt-PolemicPlusPlus'>++</span>", |
|
51 "<span class='Ldt-PolemicMinusMinus'>--</span>"]; |
|
52 |
|
53 var i = 0; |
|
54 for(i = 0; i < inputs.length; i++) { |
|
55 equal(IriSP.formatTweet(inputs[i]), outputs[i], "the correct output is given"); |
|
56 } |
48 }); |
57 }); |
49 |
58 |
50 test("test function to convert decimal color to hexadecimal", function() { |
59 test("test function to convert decimal color to hexadecimal", function() { |
51 equal(IriSP.DEC_HEXA_COLOR(125), "7D", "first test passes"); |
60 equal(IriSP.DEC_HEXA_COLOR(125), "7D", "first test passes"); |
52 equal(IriSP.DEC_HEXA_COLOR(24345), "5F19", "second test passes"); |
61 equal(IriSP.DEC_HEXA_COLOR(24345), "5F19", "second test passes"); |