chore: cleanup, ci workflows and formatting (#127064)
* ci: setup workflows, dependabot, labeler and commit linting * docs: update README, community files and issue templates * chore: configure prettier, editorconfig and format codebase * chore: restore changes lost during rebase * docs: adjust url for new logo * fix: align badges * chore: resolve conflicts and re-add temp lint
This commit is contained in:
parent
c2d978fd0a
commit
807efd502d
94 changed files with 6790 additions and 3547 deletions
|
|
@ -3,30 +3,32 @@ const { Client, LocalAuth } = require('..');
|
|||
require('dotenv').config();
|
||||
|
||||
const remoteId = process.env.WWEBJS_TEST_REMOTE_ID;
|
||||
if(!remoteId) throw new Error('The WWEBJS_TEST_REMOTE_ID environment variable has not been set.');
|
||||
if (!remoteId)
|
||||
throw new Error(
|
||||
'The WWEBJS_TEST_REMOTE_ID environment variable has not been set.',
|
||||
);
|
||||
|
||||
|
||||
function createClient({authenticated, options: additionalOpts}={}) {
|
||||
function createClient({ authenticated, options: additionalOpts } = {}) {
|
||||
const options = {};
|
||||
|
||||
if(authenticated) {
|
||||
if (authenticated) {
|
||||
const clientId = process.env.WWEBJS_TEST_CLIENT_ID;
|
||||
if(!clientId) throw new Error('No session found in environment.');
|
||||
if (!clientId) throw new Error('No session found in environment.');
|
||||
options.authStrategy = new LocalAuth({
|
||||
clientId
|
||||
clientId,
|
||||
});
|
||||
}
|
||||
|
||||
const allOpts = {...options, ...(additionalOpts || {})};
|
||||
const allOpts = { ...options, ...(additionalOpts || {}) };
|
||||
return new Client(allOpts);
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sleep,
|
||||
sleep,
|
||||
createClient,
|
||||
remoteId,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue