function init(settings) { return $('#testing').tweets(settings); } $(function() { test("Defaults and options", function() { init(); equal($.tweets._defaults.username, "ev", "placeholder username"); equal($.tweets._defaults.cycle, false, "do not cycle by default"); equal($.tweets._defaults.count, 5, "show 5 tweets by default"); equal($.tweets._defaults.animateDuration, 6000, "cycle tweet every 6 seconds"); equal($.tweets.api_method, "http://twitter.com/statuses/user_timeline/", "should equal API method"); equal($.tweets.requestUrl, "http://twitter.com/statuses/user_timeline/ev.json?count=5&callback=?", "should construct request URL"); }); test("hyperlinking tweet plain text", function() { init(); equal($.tweets._autoLinkText("you should visit twitter to see updates"), "you should visit twitter to see updates", "do nothing if text contains no links"); equal($.tweets._autoLinkText("you should visit http://twitter.com to see updates"), "you should visit http://twitter.com to see updates", "replace links with hyperlinked text"); equal($.tweets._autoLinkUsernames("tweeted by @webandy"), "tweeted by @webandy", "replace twitter usernames with hyperlinked text"); equal($.tweets._autoLinkTimestamp('50733650609836033', '08/26/2010', 'webandy'), "8/26/2010", "create formatted and hyperlinked text from timestamp"); }); test("twitter API response data", function() { init(); console.log($.tweets.responseData[0]) ok($.tweets.responseData[0].id_str, "should have an id_str property"); ok($.tweets.responseData[0].id_str.length === 17, "should be 17-chars in length"); }); });