2 * common-test.js : testing common.js for expected functionality
4 * (C) 2011, Nodejitsu Inc.
8 var assert = require('assert'),
9 vows = require('vows'),
10 utile = require('../lib');
12 vows.describe('utile/randomString').addBatch({
14 "the randomString() function": {
16 return utile.randomString();
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());
23 "when you can asked for different length strings": {
25 return [utile.randomString(4), utile.randomString(128)];
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));