UNPKG

tribune

Version:

Holy advocate to the Roman Senate, your Tribune will ensure the Consuls have your interests in mind.

30 lines (22 loc) 757 B
/* global describe it */ const assert = require('assert'); const TagArray = require('../lib/tag-array'); describe('new TagArray() -> this', () => { describe('#get(key) -> val', () => { it('gets a val by key', () => { const tags = new TagArray('$\\:\\$key:\\:\\$val'); assert.equal(tags.get(':$key'), ':$val'); }); it('returns undefined if no tag exists', () => { const tags = new TagArray(); assert.equal(tags.get('foo'), undefined); }); }); describe('#set(key, val) -> val', () => { it('set a val by key', () => { const tags = new TagArray(); assert.equal(tags.set(':$key', ':$val'), ':$val'); assert.equal(tags[0], encodeURIComponent('$\\:\\$key:\\:\\$val')); }); }); });