Skip to content

Commit

Permalink
fix(logger): make logger optional, don't use dummy logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Nov 11, 2024
1 parent 035069d commit b7615bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/database/provider/arango/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import { Logger } from 'winston';
export class ArangoGraph extends Arango implements GraphDatabaseProvider {
constructor(
db: Database,
public readonly logger: Logger,
public readonly graph: Graph,
public readonly edgeDefConfig: any,
public readonly logger?: Logger,
) {
super(db);
}
Expand Down
7 changes: 0 additions & 7 deletions src/database/provider/arango/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ const connect = async (conf: any, logger: Logger): Promise<any> => {
* @return {Arango} ArangoDB provider
*/
export const create = async (conf: any, logger: any, graphName?: string, edgeDefConfig?: any): Promise<Arango> => {
if (!logger) {
logger = {
verbose: () => { },
info: () => { },
error: () => { },
};
}
let graph;
const conn = await connect(conf, logger);
let db: Arango;
Expand Down
13 changes: 3 additions & 10 deletions test/graphs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {} from 'mocha';
import * as should from 'should';
import * as _ from 'lodash';
import { createLogger } from '@restorecommerce/logger';
Expand All @@ -24,16 +25,8 @@ const providers = [
}
];

const arrUnique = (arr) => {
let cleaned = [];
arr.forEach((itm) => {
let unique = true;
cleaned.forEach((itm2) => {
if (_.isEqual(itm, itm2)) unique = false;
});
if (unique) cleaned.push(itm);
});
return cleaned;
const arrUnique = <T>(arr: T[]) => {
return [...new Set<T>(arr)];
};

const testProvider = (providerCfg) => {
Expand Down

0 comments on commit b7615bf

Please sign in to comment.