Browse Source

Add tests for get() method

master
Luke Childs 9 years ago
parent
commit
0f135f2cd7
  1. 18
      test/unit.js

18
test/unit.js

@ -3,6 +3,8 @@ var expect = require('chai').expect;
var AtHash = require('../dist/athash');
var Parser = require('../dist/parser');
var text = "#test #text with #hashtags, @multiple @mentions and a http://url.com";
describe('AtHash', 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() {
it('Empty instance should return null', function () {

Loading…
Cancel
Save