Update bun.lock and remove DependencyManager tests
- Added new dependency "@techniker-me/tools" and updated existing dependencies to specific versions in bun.lock - Removed the DependencyManager test file as part of codebase cleanup
This commit is contained in:
15
__test__/mocks/MockDatabase.ts
Normal file
15
__test__/mocks/MockDatabase.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import type {Logger} from './MockLogger';
|
||||
|
||||
export class Database {
|
||||
private _logger: Logger;
|
||||
|
||||
constructor(logger: Logger) {
|
||||
this._logger = logger;
|
||||
}
|
||||
|
||||
public query(sql: string) {
|
||||
this._logger.debug(`Executing: ${sql}`);
|
||||
|
||||
return 'result';
|
||||
}
|
||||
}
|
||||
31
__test__/mocks/MockLogger.ts
Normal file
31
__test__/mocks/MockLogger.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
export class Logger {
|
||||
private _category: string;
|
||||
|
||||
constructor(category: string) {
|
||||
this._category = category;
|
||||
}
|
||||
|
||||
public info(message: string, ...optionalParams: any[]) {
|
||||
console.info(this.formatMessage(message), ...optionalParams);
|
||||
}
|
||||
|
||||
public debug(message: string, ...optionalParams: any[]) {
|
||||
console.debug(this.formatMessage(message), ...optionalParams);
|
||||
}
|
||||
|
||||
public error(message: string, ...optionalParams: any[]) {
|
||||
console.error(this.formatMessage(message), ...optionalParams);
|
||||
}
|
||||
|
||||
public warn(message: string, ...optionalParams: any[]) {
|
||||
console.warn(this.formatMessage(message), ...optionalParams);
|
||||
}
|
||||
|
||||
public trace(message: string, ...optionalParams: any[]) {
|
||||
console.trace(this.formatMessage(message), ...optionalParams);
|
||||
}
|
||||
|
||||
private formatMessage(message: string) {
|
||||
return `${new Date().toISOString()} [${this._category}] ${message}`;
|
||||
}
|
||||
}
|
||||
14
__test__/mocks/MockUserServices.ts
Normal file
14
__test__/mocks/MockUserServices.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type {Logger} from './MockLogger';
|
||||
import type {Database} from './MockDatabase';
|
||||
|
||||
export class UserService {
|
||||
constructor(
|
||||
private db: Database,
|
||||
private logger: Logger
|
||||
) {}
|
||||
|
||||
public getUser(id: number) {
|
||||
this.logger.debug(`Getting user ${id}`);
|
||||
return this.db.query(`SELECT * FROM users WHERE id = ${id}`);
|
||||
}
|
||||
}
|
||||
3
__test__/mocks/index.ts
Normal file
3
__test__/mocks/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './MockDatabase';
|
||||
export * from './MockLogger';
|
||||
export * from './MockUserServices';
|
||||
Reference in New Issue
Block a user