aboutsummaryrefslogtreecommitdiff
path: root/test/random.unit.js
diff options
context:
space:
mode:
authorTyler <[email protected]>2017-10-15 13:42:17 -0700
committerTyler <[email protected]>2017-10-15 13:42:17 -0700
commitef6bec454298f9582ba84dcdd661001586401e60 (patch)
tree87110a1b52be166782bd94c5df557fd033ffebee /test/random.unit.js
parent16ccfa16489be1533297158ee9f1ab5dab1a3b0f (diff)
downloadfaker-ef6bec454298f9582ba84dcdd661001586401e60.tar.xz
faker-ef6bec454298f9582ba84dcdd661001586401e60.zip
add random.alpaha with tests
Diffstat (limited to 'test/random.unit.js')
-rw-r--r--test/random.unit.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/random.unit.js b/test/random.unit.js
index e10d36be..3f7a50a8 100644
--- a/test/random.unit.js
+++ b/test/random.unit.js
@@ -164,6 +164,26 @@ describe("random.js", function () {
});
});
+ describe('alpha', function() {
+ var alpha = faker.random.alpha;
+
+ it('should return single letter when no count provided', function() {
+ assert.ok(alpha().length === 1);
+ })
+
+ it('should return lowercase letter when no upcase option provided', function() {
+ assert.ok(alpha().match(/[a-z]/));
+ })
+
+ it('should return uppercase when upcase option is true', function() {
+ assert.ok(alpha({ upcase: true }).match(/[A-Z]/));
+ })
+
+ it('should generate many random letters', function() {
+ assert.ok(alpha(5).length === 5);
+ })
+ })
+
describe('alphaNumeric', function() {
var alphaNumeric = faker.random.alphaNumeric;