Skip to content

Instantly share code, notes, and snippets.

@thiagoa
Last active December 12, 2016 14:10
Show Gist options
  • Select an option

  • Save thiagoa/35cf1d068847a6b20023cbab5bd35f83 to your computer and use it in GitHub Desktop.

Select an option

Save thiagoa/35cf1d068847a6b20023cbab5bd35f83 to your computer and use it in GitHub Desktop.
import { expect } from 'chai';
import parseOneTweet from 'app/twitter/parseOneTweet';
describe('parseOneTweet', () => {
it('returns a tweet object with parsed text', () => {
const tweet = {
created_at: '2016-01-01T00:00:00.000-03:00',
mentions: ['dude'],
text: '@dude 1 shot of Tequila\n\n2 shots of Tequila...\n3 shots of Tequila...',
};
const newTweet = parseOneTweet(tweet);
expect(newTweet.created_at).to.equal('2016-01-01T00:00:00.000-03:00');
expect(newTweet.mentions).to.deep.equal(['dude']);
expect(newTweet.text).to.equal(
'<p><a href="#" data-js-mention>@dude</a> 1 shot of Tequila</p>' +
'<p>2 shots of Tequila...<br>3 shots of Tequila...</p>'
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment