From 0f135f2cd79fd416d73b44b29e5d72f8efb4877f Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Sat, 16 Apr 2016 17:16:27 +0100 Subject: [PATCH] Add tests for get() method --- test/unit.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/unit.js b/test/unit.js index 3d3d9db..fb82c10 100644 --- a/test/unit.js +++ b/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 () {