UNPKG

howsmydriving-twitter

Version:

Twitter abstraction for @HowsMyDrivingWA.

34 lines (33 loc) 1.49 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var twitter_1 = require("../src/twitter"); // TODO: move this to utils. var twitter_2 = require("./mocks/twitter"); var assert = require('assert'); var user = { userName: 'echo', avatar: 'echo.png' }; describe('Tweet chomping', function () { describe('chomp reply tweet', function () { it('should remove users at start of full_text if display_text_range specifies a display range', function () { var _a = twitter_1.chompTweet(twitter_2.createTweet({ full_text: '@TestUser1 @TestUser2 This is the tweet', display_text_range: [22, 17] })), chomped = _a.chomped, chomped_text = _a.chomped_text; assert.equal(chomped_text, 'This is the tweet'); }); }); describe('chomp empty tweet', function () { it('should return empty string', function () { var _a = twitter_1.chompTweet(twitter_2.createTweet({ full_text: '' })), chomped = _a.chomped, chomped_text = _a.chomped_text; assert.equal(chomped_text, ''); }); }); describe('chomp non-reply tweet', function () { it('should return exactly full_text', function () { var _a = twitter_1.chompTweet(twitter_2.createTweet({ full_text: 'This is just a tweet.' })), chomped = _a.chomped, chomped_text = _a.chomped_text; assert.equal(chomped_text, 'This is just a tweet.'); }); }); });