write test for cleanUpTag

v1.18.x
barisusakli 8 years ago
parent 3270f39db0
commit acc7e160ef

@ -1,8 +1,8 @@
'use strict';
/*global require*/
var assert = require('assert'),
utils = require('./../public/src/utils.js');
var assert = require('assert');
var utils = require('./../public/src/utils.js');
describe('Utility Methods', function () {
@ -35,4 +35,21 @@ describe('Utility Methods', function (){
assert.notEqual(uuid1, uuid2, 'matches');
});
});
describe('cleanUpTag', function () {
it('should cleanUp a tag', function (done) {
var cleanedTag = utils.cleanUpTag(',\/#!$%\^\*;TaG1:{}=_`<>\'"~()?\|');
assert.equal(cleanedTag, 'tag1');
done();
});
it('should return empty string for invalid tags', function (done) {
assert.strictEqual(utils.cleanUpTag(undefined), '');
assert.strictEqual(utils.cleanUpTag(null), '');
assert.strictEqual(utils.cleanUpTag(false), '');
assert.strictEqual(utils.cleanUpTag(1), '');
assert.strictEqual(utils.cleanUpTag(0), '');
done();
});
});
});

Loading…
Cancel
Save