|
@ -3,6 +3,8 @@ var expect = require('chai').expect; |
|
|
var AtHash = require('../dist/athash'); |
|
|
var AtHash = require('../dist/athash'); |
|
|
var Parser = require('../dist/parser'); |
|
|
var Parser = require('../dist/parser'); |
|
|
|
|
|
|
|
|
|
|
|
var text = "#test #text with #hashtags, @multiple @mentions and a http://url.com"; |
|
|
|
|
|
|
|
|
describe('AtHash', function() { |
|
|
describe('AtHash', function() { |
|
|
|
|
|
|
|
|
it('Should return instance of parser', function () { |
|
|
it('Should return instance of parser', function () { |
|
@ -24,6 +26,22 @@ describe('AtHash', function() { |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('.get()', function() { |
|
|
|
|
|
|
|
|
|
|
|
it('Run with no text', function () { |
|
|
|
|
|
expect(AtHash().get('hashtags')).to.deep.equal([]); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Return empty array on no matches', function () { |
|
|
|
|
|
expect(AtHash('').get('hashtags')).to.deep.equal([]); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Get hashtag array from text', function () { |
|
|
|
|
|
expect(AtHash(text).get('hashtags')).to.deep.equal(['#test', '#text', '#hashtags']); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
describe('.parse()', function() { |
|
|
describe('.parse()', function() { |
|
|
|
|
|
|
|
|
it('Empty instance should return null', function () { |
|
|
it('Empty instance should return null', function () { |
|
|