archunit
Version:
ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app
27 lines • 1.01 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.OrderService = void 0;
const payment_service_1 = require("../PaymentService/payment-service");
/* eslint-disable @typescript-eslint/no-explicit-any */
class OrderService {
constructor() {
this.paymentService = new payment_service_1.PaymentService();
}
getOrdersByUser(userId) {
return null; // not implemented
}
createOrder(orderData) {
console.log('Creating order:', orderData);
// This creates a dependency from OrderService to PaymentService
const paymentResult = this.paymentService.processPayment(orderData.amount);
if (paymentResult) {
return `Order created with ID: ${Math.random().toString(36).substr(2, 9)}`;
}
throw new Error('Payment failed');
}
validateOrder(orderData) {
return orderData && orderData.amount > 0;
}
}
exports.OrderService = OrderService;
//# sourceMappingURL=order-service.js.map
;