randex
Version:
Generates random filename, username, email, name, full name, etc for test purposes.
29 lines (28 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var custom_1 = require("../custom");
var test_util_1 = require("./test-util");
describe("randomEmail", function () {
it("simple", function () {
test_util_1.TestUtil.loop(function () {
var value = custom_1.Randex.username();
expect(test_util_1.TestUtil.isUsernameValid(value)).toBeTruthy();
});
});
it("options", function () {
var value = custom_1.Randex.username({ length: 5 });
expect(value.length).toBe(5);
value = custom_1.Randex.username(5);
expect(value.length).toBe(5);
//
value = custom_1.Randex.username({ length: [5, 5] });
expect(value.length).toBe(5);
value = custom_1.Randex.username([5, 5]);
expect(value.length).toBe(5);
//
value = custom_1.Randex.username({ length: [1, 5] });
expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
value = custom_1.Randex.username([1, 5]);
expect(test_util_1.TestUtil.inNumberRange(value.length, [1, 5])).toBeTruthy();
});
});