mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 15:36:16 -04:00
tests: Basic USER_CHANGES backend tests
This commit is contained in:
parent
2cae414473
commit
dbacc73c36
2 changed files with 118 additions and 0 deletions
|
@ -184,3 +184,18 @@ exports.handshake = async (socket, padId) => {
|
|||
logger.debug('received CLIENT_VARS message');
|
||||
return msg;
|
||||
};
|
||||
|
||||
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
/**
|
||||
* Generates a random string.
|
||||
*
|
||||
* @param {number} [len] - The desired length of the generated string.
|
||||
* @param {string} [charset] - Characters to pick from.
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.randomString = (len = 10, charset = `${alphabet}${alphabet.toUpperCase()}0123456789`) => {
|
||||
let ret = '';
|
||||
while (ret.length < len) ret += charset[Math.floor(Math.random() * charset.length)];
|
||||
return ret;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue