Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / utile / test / random-string-test.js
1 /*
2  * common-test.js : testing common.js for expected functionality
3  *
4  * (C) 2011, Nodejitsu Inc.
5  *
6  */
7
8 var assert = require('assert'),
9     vows = require('vows'),
10     utile = require('../lib');
11
12 vows.describe('utile/randomString').addBatch({
13   "When using utile": {
14     "the randomString() function": {
15       topic: function () {
16         return utile.randomString();
17       },
18       "should return 16 characters that are actually random by default": function (random) {
19         assert.isString(random);
20         assert.lengthOf(random, 16);
21         assert.notEqual(random, utile.randomString());
22       },
23       "when you can asked for different length strings": {
24         topic: function () {
25           return [utile.randomString(4), utile.randomString(128)];
26         },
27         "where they actually are of length 4, 128": function (strings) {
28           assert.isArray(strings);
29           assert.lengthOf(strings,2);
30           assert.isString(strings[0]);
31           assert.isString(strings[1]);
32           assert.lengthOf(strings[0], 4);
33           assert.lengthOf(strings[1], 128);
34           assert.notEqual(strings[0], strings[1].substr(0,4));
35         }
36       }
37     }
38   }
39 }).export(module);