UNPKG

simple-random

Version:

A simple flexible javascript library that creates random alpha-numeric strings. Works in both NodeJS and the browser.

18 lines (16 loc) 615 B
describe('defaults', function () { var should = require('chai').should(); const defaultChars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var simpleRandom = require("../index.js"); it('should have length of 16', function () { var random = simpleRandom(); random.should.have.length(16); }); it("should only use default chars", function () { var random = simpleRandom(); var randomArray = random.split(""); randomArray.forEach(function (char) { defaultChars.indexOf(char).should.be.above(-1); }); }); });