Skip to content

Commit

Permalink
Restyle Remove chromedrive from test workflow as wdio should configure (
Browse files Browse the repository at this point in the history
#875)

* style: format code with clang-format

* style: format code with jq

* style: format code with prettier

* style: format code with prettier-json

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
restyled-io[bot] and restyled-commits authored Jun 19, 2024
1 parent e03a05b commit 7f84d58
Show file tree
Hide file tree
Showing 34 changed files with 190 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function createLabelIdsReceiver(parentMeetingSeriesId) {
const label = Label.findLabelsContainingSubstring(
parentMeetingSeriesId,
labelName,
caseSensitive
caseSensitive,
);
if (label !== null) {
return label.map((label) => {
Expand All @@ -17,9 +17,10 @@ export function createLabelIdsReceiver(parentMeetingSeriesId) {
};
}
export function createUserIdsReceiver(userName) {
const users = userName === "me"
? [Meteor.user()]
: Meteor.users.find({ username: { $regex: userName } }).fetch();
const users =
userName === "me"
? [Meteor.user()]
: Meteor.users.find({ username: { $regex: userName } }).fetch();
if (users) {
return users.map((user) => {
return user._id;
Expand Down
1 change: 1 addition & 0 deletions imports/infoitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { _ } from "lodash";
import { Meteor } from "meteor/meteor";
import { Random } from "meteor/random";

import { formatDateISO8601 } from "./helpers/date.js";
import { StringUtils } from "./helpers/string-utils.js";
import { User } from "./user.js";
Expand Down
6 changes: 1 addition & 5 deletions imports/ldap/getLDAPUsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ const _fetchLDAPUsers = (connection) => {
const settings = connection.settings;
const base = settings.serverDn;
const searchDn = get(settings, "propertyMap.username", "cn");
const userLongNameAttribute = get(
settings,
"propertyMap.longname",
searchDn,
);
const userLongNameAttribute = get(settings, "propertyMap.longname", searchDn);
const emailAttribute = get(settings, "propertyMap.email", searchDn);
const filter = `(&(${searchDn}=*)${settings.searchFilter})`;
const scope = "sub";
Expand Down
11 changes: 7 additions & 4 deletions imports/ldap/saveUsers.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MongoClient as mongo } from "mongodb";
import { forEach, map } from "lodash";
import { parse } from "mongo-uri";
import transformUser from "./transformUser";
import { MongoClient as mongo } from "mongodb";

import { map, forEach } from "lodash";
import { generateId } from "../../tests/performance/fixtures/lib/random";

import transformUser from "./transformUser";

const _transformUsers = (settings, users) =>
map(users, (user) => transformUser(settings, user));

Expand Down Expand Up @@ -55,7 +56,9 @@ const _insertUsers = (client, mongoUri, users) => {
} else {
const stringifiedUser = JSON.stringify(user, null, 2);
console.log(
`SKIPPED INVALID USER (no username or no valid emails[0].address): ${stringifiedUser}`,
`SKIPPED INVALID USER (no username or no valid emails[0].address): ${
stringifiedUser
}`,
);
}
});
Expand Down
4 changes: 2 additions & 2 deletions imports/ldap/transformUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { pick } from "lodash";
* @param {...*} args - The values to exclude from the filtered array.
* @returns {Array} - A new array with the values excluded.
*/
const without = (arr, ...args) => arr.filter(item => !args.includes(item))
const without = (arr, ...args) => arr.filter((item) => !args.includes(item));
export default (ldapSettings, userData) => {
ldapSettings.propertyMap = ldapSettings.propertyMap || {};
const usernameAttribute =
ldapSettings.searchDn || ldapSettings.propertyMap.username || "cn";
ldapSettings.searchDn || ldapSettings.propertyMap.username || "cn";
const longnameAttribute = ldapSettings.propertyMap.longname;
const mailAttribute = ldapSettings.propertyMap.email || "mail";

Expand Down
2 changes: 1 addition & 1 deletion imports/priority.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { __ } from "meteor/universe:i18n";
import assert from "assert";
import { __ } from "meteor/universe:i18n";

// #I18N - Attention: the below strings with longer texts will be never be used
// in UI! Instead they will be pulled from translation language files via
Expand Down
8 changes: 3 additions & 5 deletions imports/server/exportimport/expImpFilesAttachments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpFilesAttachments {
static get FILENAME_POSTFIX() {
Expand Down Expand Up @@ -37,9 +37,7 @@ class ExpImpFilesAttachments {
const attachmentFile = msID + ExpImpFilesAttachments.FILENAME_POSTFIX;
let AllAttachmentsDoc = undefined;
try {
AllAttachmentsDoc = parse(
readFileSync(attachmentFile, "utf8"),
);
AllAttachmentsDoc = parse(readFileSync(attachmentFile, "utf8"));
if (!AllAttachmentsDoc) {
return reject(`Could not read attachment file ${attachmentFile}`);
}
Expand Down
4 changes: 2 additions & 2 deletions imports/server/exportimport/expImpFilesDocuments.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpFilesDocuments {
static get FILENAME_POSTFIX() {
Expand Down
4 changes: 2 additions & 2 deletions imports/server/exportimport/expImpMeetingseries.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpMeetingSeries {
static get FILENAME_POSTFIX() {
Expand Down
5 changes: 3 additions & 2 deletions imports/server/exportimport/expImpMinutes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

import { patchUsers as _patchUsers } from "./expImpTopics";

class ExpImpMinutes {
Expand Down
24 changes: 17 additions & 7 deletions imports/server/exportimport/expImpSchema.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpSchema {
static get MADE_FOR_SCHEMA() {
Expand All @@ -20,10 +20,14 @@ class ExpImpSchema {
if (ExpImpSchema.MADE_FOR_SCHEMA !== doc.version) {
console.log("*** WARNING *** Schema mismatch!");
console.log(
` This exporter is made for database schema version: ${ExpImpSchema.MADE_FOR_SCHEMA}`,
` This exporter is made for database schema version: ${
ExpImpSchema.MADE_FOR_SCHEMA
}`,
);
console.log(
` But your database has schema version : ${doc.version}`,
` But your database has schema version : ${
doc.version
}`,
);
console.log(
" Alyways migrate to the most recent DB schema before export!",
Expand Down Expand Up @@ -72,13 +76,19 @@ class ExpImpSchema {
) {
console.log("*** WARNING *** Schema mismatch!");
console.log(
` This importer is made for database schema version: ${ExpImpSchema.MADE_FOR_SCHEMA}`,
` This importer is made for database schema version: ${
ExpImpSchema.MADE_FOR_SCHEMA
}`,
);
console.log(
` Your database has schema version : ${doc.version}`,
` Your database has schema version : ${
doc.version
}`,
);
console.log(
` Your exported data has schema version : ${exportedSchema.version}`,
` Your exported data has schema version : ${
exportedSchema.version
}`,
);
console.log(
" Alyways migrate to the most recent DB schema before export/import!",
Expand Down
4 changes: 2 additions & 2 deletions imports/server/exportimport/expImpTopics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpTopics {
static get FILENAME_POSTFIX() {
Expand Down
12 changes: 8 additions & 4 deletions imports/server/exportimport/expImpUsers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { writeFileSync, readFileSync } from "fs";
import { stringify, parse } from "bson";
import { parse, stringify } from "bson";
import { readFileSync, writeFileSync } from "fs";

class ExpImpUsers {
static get FILENAME_POSTFIX() {
Expand Down Expand Up @@ -108,11 +108,15 @@ class ExpImpUsers {
if (doc) {
console.log(`Found ${doc.length} target users in current user DB.`);
console.log(
`Will copy over ${usrCopyIDs.length} export users to current user DB.`,
`Will copy over ${
usrCopyIDs.length
} export users to current user DB.`,
);
if (doc.length !== usrMapTargetIDs.length) {
return reject(
`Not all to-be patched target users found in current user DB: ${usrMapTargetIDs}`,
`Not all to-be patched target users found in current user DB: ${
usrMapTargetIDs
}`,
);
}
// Check#2: All copy-users MUST NOT exist!
Expand Down
16 changes: 11 additions & 5 deletions private/exportMeetingSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,19 @@
*/

import { MongoClient as mongo } from "mongodb";
import { MADE_FOR_SCHEMA, exportCheck } from "../imports/server/exportimport/expImpSchema";
import { bindHelp, create, showHelp } from "node-getopt";

import { doExport as ___doExport } from "../imports/server/exportimport/expImpFilesAttachments";
import { doExport as ____doExport } from "../imports/server/exportimport/expImpFilesDocuments";
import { doExport } from "../imports/server/exportimport/expImpMeetingseries";
import { doExport as _doExport } from "../imports/server/exportimport/expImpMinutes";
import {
exportCheck,
MADE_FOR_SCHEMA,
} from "../imports/server/exportimport/expImpSchema";
import { doExport as __doExport } from "../imports/server/exportimport/expImpTopics";
import { doExport as ___doExport } from "../imports/server/exportimport/expImpFilesAttachments";
import { doExport as ____doExport } from "../imports/server/exportimport/expImpFilesDocuments";
import { doExport as _____doExport } from "../imports/server/exportimport/expImpUsers";

import { create, bindHelp, showHelp } from "node-getopt";
create([
["i", "id=[ARG]", "ID of meeting series, e.g. icwrCdJjqWpoH9ugQ"],
["m", "mongourl=[ARG]", "Mongo DB url, e.g. mongodb://localhost:3101/meteor"],
Expand Down Expand Up @@ -43,7 +47,9 @@ const _connectMongo = function (mongoUrl) {

console.log("");
console.log(
`*** 4Minitz MeetingSeries Export Tool *** (made for schema version: ${MADE_FOR_SCHEMA})`,
`*** 4Minitz MeetingSeries Export Tool *** (made for schema version: ${
MADE_FOR_SCHEMA
})`,
);
_connectMongo(mongoUrl)
.then((db) => {
Expand Down
11 changes: 7 additions & 4 deletions private/importMeetingSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { spawnSync } from "child_process";
import { MongoClient as mongo } from "mongodb";
import { bindHelp, create, showHelp } from "node-getopt";

import { ExpImpFileAttachments } from "../imports/server/exportimport/expImpFilesAttachments";
import { ExpImpFileDocuments } from "../imports/server/exportimport/expImpFilesDocuments";
import { ExpImpMeetingSeries } from "../imports/server/exportimport/expImpMeetingseries";
Expand Down Expand Up @@ -45,17 +46,19 @@ const _connectMongo = (mongoUrl) =>

console.log("");
console.log(
`*** 4Minitz MeetingSeries Import Tool *** (made for schema version: ${ExpImpSchema.MADE_FOR_SCHEMA})`
`*** 4Minitz MeetingSeries Import Tool *** (made for schema version: ${
ExpImpSchema.MADE_FOR_SCHEMA
})`,
);
console.log("*** ATTENTION ***");
console.log(
"- This script will import a meeting series and all dependecies to your DB."
"- This script will import a meeting series and all dependecies to your DB.",
);
console.log(
"- This script has to change existing user roles, so users can access the new data."
"- This script has to change existing user roles, so users can access the new data.",
);
console.log(
"- This script may overwrite edited data if you import the same data multiple times."
"- This script may overwrite edited data if you import the same data multiple times.",
);
console.log("So, this script is DANGEROUS!!!");
console.log("Experts only!");
Expand Down
4 changes: 2 additions & 2 deletions programs/generateLicenseList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dumpLicenses } from "npm-license-crawler";
import { createWriteStream } from "fs";
import { get as _get } from "http";
import { get as __get } from "https";
import { createWriteStream } from "fs";
import { dumpLicenses } from "npm-license-crawler";

const meteorPackages = {
meteor: {
Expand Down
2 changes: 1 addition & 1 deletion programs/postInstall.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
import pkg from 'fs-extra';
import pkg from "fs-extra";
const { copySync, removeSync } = pkg;

console.log("copy bootstrap fonts to the public folder");
Expand Down
4 changes: 3 additions & 1 deletion tests/support/end2end-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import run from "./lib/task.js";
import { createInterface, on } from "readline";

import run from "./lib/task.js";

function logTask(taskname) {
return (data) => {
process.stdout.write(`${taskname}: ${data}`);
Expand Down
10 changes: 8 additions & 2 deletions tests/support/ldap-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
* @module ldap-server
*/

import pkg from 'ldapjs';
const { createServer, InsufficientAccessRightsError, UnwillingToPerformError, NoSuchObjectError, InvalidCredentialsError } = pkg
import pkg from "ldapjs";
const {
createServer,
InsufficientAccessRightsError,
UnwillingToPerformError,
NoSuchObjectError,
InvalidCredentialsError,
} = pkg;

/**
* Array of user objects representing LDAP users.
Expand Down
18 changes: 13 additions & 5 deletions tests/unit/client/helpers/submitOnEnter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ import sinon from "sinon";

const jQueryOnStub = sinon.stub();

const submitOnEnter = await esmock("../../../../client/helpers/submitOnEnter", {
"meteor/jquery": { $: () => sinon.stub().returns({ on: jQueryOnStub, }) },
}, {}, {
isModuleNotFoundError: false
}).default;
const submitOnEnter = await esmock(
"../../../../client/helpers/submitOnEnter",
{
"meteor/jquery": {
$: () =>
sinon.stub().returns({
on: jQueryOnStub,
}),
},
},
{},
{ isModuleNotFoundError: false },
).default;

// skipcq: JS-0241
describe("submitOnEnter", function () {
Expand Down
Loading

0 comments on commit 7f84d58

Please sign in to comment.