honion
Version:
24 lines (19 loc) • 541 B
text/typescript
import { Middleware } from "../../src";
import { TestHonion } from "../test-honion";
test("middleware pipeline", async () => {
const honion = new TestHonion().add(new Md());
let ctx = await honion.run();
expect(ctx.get("num")).toBe(1);
ctx = await honion.run();
expect(ctx.get("num")).toBe(2);
ctx = await honion.run();
expect(ctx.get("num")).toBe(3);
});
class Md extends Middleware {
async invoke(): Promise<void> {
this.
this.ctx.set("num", this.
await this.next();
}
}