我有一个正在编写单元测试的打字稿文件。如何编写用于静态方法配置的单元测试。我正在用摩卡柴
import * as log4js from "log4js";
import { Express, Request, Response } from "express";
export class Test {
static configuration(app: Express) {
app.post('/config', function (req: Request, res: Response) {
console.log('setting log with :', req.body);
let categoryName: string = req.body.category;
console.log('categoryName:', categoryName);
let level: string = req.body.level;
let logger: log4js.Logger = log4js.getLogger(categoryName);
logger.level = level;
res.send(categoryName);
});
app.get('/config/:categoryName', function (req: Request, res: Response)
{
console.log('getting logger for :', req.params.categoryName);
}