write test for cleanUpTag

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

@ -1,8 +1,8 @@
'use strict'; 'use strict';
/*global require*/ /*global require*/
var assert = require('assert'), var assert = require('assert');
utils = require('./../public/src/utils.js'); var utils = require('./../public/src/utils.js');
describe('Utility Methods', function () { describe('Utility Methods', function () {
@ -35,4 +35,21 @@ describe('Utility Methods', function (){
assert.notEqual(uuid1, uuid2, 'matches'); 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