diff --git a/test/support/general.helper.js b/test/support/general.helper.js new file mode 100644 index 0000000000..b818f450c5 --- /dev/null +++ b/test/support/general.helper.js @@ -0,0 +1,24 @@ +'use strict' + +/** + * General helper functions available to all helpers + * @module GeneralHelper + */ + +/** + * Generate a random integer within a range (inclusive) + * + * @param {Number} min lowest number (integer) in the range (inclusive) + * @param {Number} max largest number (integer) in the range (inclusive) + * + * Credit https://stackoverflow.com/a/7228322 + * + * @returns a number between min and max (inclusive) + */ +function randomInteger (min, max) { + return Math.floor(Math.random() * (max - min + 1) + min) +} + +module.exports = { + randomInteger +}