randex
Version:
Generates random filename, username, email, name, full name, etc for test purposes.
29 lines (28 loc) • 929 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var set_1 = require("../basic/set");
var defaultLength = [1, 10];
function getLength(reservedChars, length, resultLength) {
var result = set_1.RandexSetUtil.getLength(reservedChars, length, defaultLength);
if (typeof resultLength === "number") {
expect(result).toBe(resultLength);
}
else {
expect(result).toMatchObject(resultLength);
}
}
describe("RandexSetUtil", function () {
describe("getLength", function () {
it("single", function () {
getLength(0, 2, 2);
getLength(1, 3, 2);
getLength(0, undefined, defaultLength);
getLength(5, 3, defaultLength);
});
it("array", function () {
getLength(0, [1, 2], [1, 2]);
getLength(1, [2, 3], [1, 2]);
getLength(3, [1, 5], defaultLength);
});
});
});